다음을 통해 공유


How to: Add Installation Components to Your Projects 

Installation components are used to perform actions during the installation of an application (for example, creating and configuring resources such as message queues or databases). There are two types of installation components: installer classes that can be added to any project, and predefined installation components that are associated with specific components. The procedure for adding installation components differs for each type.

NoteNote

The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.

To add an installer class to your project

  1. In Solution Explorer, select the project where you want to add the class. On the Project menu, choose Add New Item.

  2. In the Add New Item dialog box, select Installer Class.

  3. Override any methods for which you need to perform custom processing. For details, see How to: Override Default Methods on Installation Components.

    Microsoft Visual Studio ships predefined installation components that can install resources associated with your MessageQueue components, EventLog components, Windows service applications, and PerformanceCounter components. When you work with an instance of one of these components or application types, you can select a hyperlink in the Properties window to automatically add the appropriate installer to your project.

    After you add the first installation component to your project, a class named Installer1 appears in your project. Each subsequent installation component you place in the project is also added to that class. The Installer1 class is automatically registered with the deployment project for your solution.

    Visual Studio automatically copies property values that are needed to create your components to the installation component. In some cases, you may have to modify the copied values. For more information, see How to: Configure Installation Components.

To add a predefined installation component to your project

  1. In the designer, click the background of the designer, rather than any of its contents.

  2. With the designer in focus, right-click, and then click Add Installer.

    NoteNote

    Predefined installation components are only available for MessageQueue, EventLog, and PerformanceCounter components, and for service applications. If you are working with a service application, you select the Component Designer surface rather than any particular component.

    The Installer1 class appears in your project and an installation component is added to it.

  3. If necessary, access the Installer1 class in the Code Editor and modify any of the values that were copied to the installation component. For more information, see How to: Configure Installation Components.

  4. Override any methods for which you need to perform custom processing. For more information, see How to: Override Default Methods on Installation Components.

  5. Continue to perform steps 1 through 3 for each installation component your project needs.

See Also

Tasks

How to: Configure Installation Components
How to: Override Default Methods on Installation Components