RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Building Custom Installer Classes in .NET

When it comes to installations, automation beats manual intervention hands-down every time. Learn how to build custom installer classes to automate setup tasks that Visual Studio setup projects don't handle automatically.


isual Studio setup projects provide a quick and easy way for end-users to deploy your application, whether it is a Web site, Windows NT service, smart client, or Web service. Even though the .NET framework introduced the idea of "xcopy deployment," for many projects it is useful (or expected) that you automate all the tasks required by your installation procedure, thus ensuring the consistency and repeatability of the installation process. When you do that, system administrators and end users gain the ability to perform the installation process without technical assistance—and you avoid the need to provide detailed end-user documentation on the process.

A standard Visual Studio setup project can copy files and create directories on the target file system, create start menus, and create registry entries. If you need to do more, you may need to implement custom actions.

MSI Custom Installer Actions
Since the release of the Windows Installer component, most third-party (and Microsoft) setup-creation tools make use of it as a common base of functionality. Windows Installer setups allow developers to execute both standard actions and custom actions as part of a setup sequence.

You use custom actions when you need to perform special or application-specific tasks that standard actions cannot accomplish. The .NET framework exposes the custom actions capability via the Installer class, whose methods you override to perform tasks of your choice.

Author's Note: The techniques shown in this article work with the .NET framework 1.0 or 1.1 and Visual Studio. The code samples were written using Visual Studio 2003 and .NET 1.1

Create Your Own Custom Action in .NET
To add a custom action to your setup project, you need to:

  1. Create an installer class.
  2. Override the Install and Uninstall methods.
  3. Test your installer class implementation using the .NET installer utility.
  4. Configure your setup project to use your custom installer.

Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date