Setup
  Create system resources
  Execute custom setup code

Get URL for this page

How Do I...Create System Resources During Installation?

An application can consist not only of traditional program files, but also of associated resources such as message queues, event logs, and performance counters that must be created on the deployment destination. You can configure your application to create these resources when your application is installed and to remove them if your application is uninstalled, by using installation components.

This sample illustrates how to build an application that will set up its own message queue and its own event log during installation and delete those two system resources when the application is uninstalled. To run the sample you need to have message queueing installed on your machine. You can install message queueing from Start -> Settings -> Control Panel -> Add/Remove Programs -> Add/Remove System Components.

Run the following command line to install the system resources:

> InstallUtil.exe Installers.exe

Now, you can verify in the message queuing management console that an "InstallersSample" message queue was installed, and that an "InstallersSample" event log source was set up in the registry.

To uninstall the message queue and the event log source, run the following command:

>InstallUtil.exe /u Installers.exe

How does it work? The InstallUtil.exe will search, using the Reflection mechanism, all assemblies passed as the command line arguments for classes inheriting from Installer class and with RunInstallerAttribute set to true. The Installers then handle the install and uninstall actions. 

Example

 
VB Installers.exe

[Run Sample] | [View Source]


Copyright 2001 Microsoft Corporation. All rights reserved.