Introduction to Installation Components
In Microsoft Visual Studio 6.0, application setup typically involved copying all of the run-time and support files associated with an application from the development computer to the target computer. In Visual Studio 2005, an application consists not only of the traditional program files but also of associated resources, such as message queues, event logs, performance counters, databases, and configuration files, that must be created on the target computer, as well. You can configure your application to create these resources when your application is installed and to remove them if your application is uninstalled, using what are called installation components.
For example, suppose you are deploying an application that writes to a custom performance counter. The counter must be installed when the application is deployed. Using an installation component, you can set up the application so that it automatically creates and configures the necessary performance counter on a remote computer when the application is installed.
There are two types of installation components: installer classes that can be added to your project, and pre-defined installation components that are associated with components.
Installer classes can be added to any application to perform actions during installation (for example, creating a database on a target computer). In a deployment project, the compiled installer classes from your project are added as custom actions that are run at the end of installation. Deployment projects also have the ability to capture user input during installation and pass it to the installer class using the CustomActionData property — for example, you might want to let the user choose a location for a database. For more information on consuming installation components in deployment projects, see Walkthrough: Using a Custom Action to Create a Database at Installation.
Predefined installation components are associated on a one-to-one basis with the components that need them. For example, if you have an instance of the MessageQueue component in your project and it requires your deployed application to have a queue installed and configured, you create an installation component to handle the task. If you then add an instance of the EventLog component to your project and want to configure the event log in use, you must add a second installation component to perform that processing.
There are five predefined installation components that you can use in your projects:
The EventLog installer (based on the EventLogInstaller class) allows you to install and configure a custom event log that your application needs in order to run. For more information, see Introduction to the EventLog Component.
The MessageQueue installer (based on the MessageQueueInstaller class) allows you to install and configure a queue that your application needs in order to run. For more information, see Using Messaging Components.
The PerformanceCounter installer (based on the PerformanceCounterInstaller class) allows you to install and configure a custom performance counter that your application needs in order to run. For more information, see Monitoring Performance Thresholds.
All of the installation components in a project are stored within classes marked with the RunInstallerAttribute. By default, a class named Installer1 that contains this attribute is added to your project when you add a predefined installation component; installer classes added using the Add New Item dialog box also contain this attribute and are named Installer1 by default. For more information on what happens during the installation process, see Installation Process.