Click here to Skip to main content
Licence CPOL
First Posted 8 Apr 2009
Views 9,053
Downloads 149
Bookmarked 11 times

Deploying Custom Tool on a developer machine using a Setup Project

By | 8 Apr 2009 | Article
Making a custom tool work on the developers machine requires several actions like placing keys in the registry and registering your DLL Library using the regasm command. This post will discuss the automation of these procedures using a setup project.

Introduction

Making a custom tool work on the developers machine requires several actions like placing keys in the registry and registering your DLL library using the regasm command. This post will discuss the automation of these procedures using a setup project. For more information on making your own custom tool, visit my post Building a Custom Tool Generator For Visual Studio.

Using the Code

First add a class in your CustomTool Library Project that inherits from the Installer class. In this class, override two methods; the first is the Install method and the second is the Uninstall method. To get the regasm.exe path, you could use the InteropServices.RuntimeEnvironment class to get the runtime directory of the .NET Framework. Then you need to get the assembly location. After that, you could simply start the process of the regasm and pass to it the /codebase parameter and the path of the library.

public override void Install(System.Collections.IDictionary stateSaver)
{
    base.Install(stateSaver);
    string regasmPath = System.Runtime.InteropServices.RuntimeEnvironment.
					GetRuntimeDirectory() + @"regasm.exe";
    string componentPath = base.GetType().Assembly.Location;
    System.Diagnostics.Process.Start(regasmPath, "/codebase \"" + componentPath + "\"");
}

To uninstall, remove the component registration by the /unregister parameter:

public override void Uninstall(System.Collections.IDictionary savedState)
{
    base.Uninstall(savedState);
    string regasmPath = System.Runtime.InteropServices.RuntimeEnvironment.
					GetRuntimeDirectory() + @"regasm.exe";
    string componentPath = base.GetType().Assembly.Location;
    System.Diagnostics.Process.Start
		(regasmPath, "/unregister \"" + componentPath + "\"");
}

The Setup Project

Now make a new setup project and add the output of the CustomTool Library to it. Then Right Click the setup project and select view, then select custom actions.

customactions2

Then Add the CustomTool Project output to the Install and Uninstall Sections as in the image below:

customtoolsetup

OK now you need to add the registry values. Right click on the setup project and then View then select Registry. To add the needed Registry Values, follow the structure in the figure below:

customtoolregistry

Share Your Thoughts

Now all you have to do is just build the setup project and you will have a setup deployment for your custom tool. Please share your thoughts and feel free to drop any comments. Hope you enjoy the project.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

RMostafa

Software Developer (Senior)
Code Republic
Egypt Egypt

Member

My name is Ramy Mostafa. I’m From Alexandria,Egypt currently living in Cairo,Egypt. I have graduated from the Arab Academy for Science and Technology and Maritime Transport with a BS. in Computer Science, also I’m a Microsoft Certified Professional since 2004. I have extensive professional experience as a developer and expertise in OOP, OOA, OOD and problem solving techniques. Currently I’m working as a senior developer in Code Republic a European owned and directed software outsourcing company based in Egypt with liaison offices in Europe.
 
Also I’m a huge fan of Al-Ahly Club, I like reading, swimming and diving -used to play in the national team of finswimming in Egypt- worth to mention that I like reading Ragol El Mostahel and Malaf el Mostakbal (a huge fan of it actually Smile | :) )
 
To reach me, you can either send me an e-mail at ramy.mostafa@gmail.com or call at (002) 010 3332382

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralUsing RegistrationServices.RegisterAssembly instead Pinmemberrusso798:29 8 Apr '09  
GeneralRe: Using RegistrationServices.RegisterAssembly instead PinmemberRMostafa21:55 8 Apr '09  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120517.1 | Last Updated 9 Apr 2009
Article Copyright 2009 by RMostafa
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid