다음을 통해 공유


How to: Configure Installation Components 

When an installation component is created for a component in your project, Visual Studio copies property values that are necessary for the installer to recreate the chosen resource. For example, for an EventLog installer, the system copies the values of the Log and Source properties and uses these values during installation to create your log in the correct location.

The property values are copied either from the component or from the resource with which the component interacts on your test server. For example, suppose you have an instance of the MessageQueue component that interacts with a test queue called OrdersReceived on a server called server1. When you create an installer for this component, it copies the Path property's value from the component, and then uses this to locate the resource on the test computer. All of the properties set for that resource on the test computer are also copied to installation code. If there is no physical test resource, the system copies all of its values from the component, and you need to fill in the missing necessary properties manually in the Installer1 class.

The following code shows how the default properties for this MessageQueue installer might look in the Installer1 class:

Private WithEvents MessageQueueInstaller1 As System.Messaging.MessageQueueInstaller
Private Sub InitializeComponent()
    Me.MessageQueueInstaller1 = New System.Messaging.MessageQueueInstaller
    MessageQueueInstaller1.MaximumJournalSize = 4294967295&
    MessageQueueInstaller1.BasePriority = 0%
    MessageQueueInstaller1.Path = "server1\OrdersReceived"
    Me.Installers.Add(MessageQueueInstaller1)
End Sub
System.Messaging.MessageQueueInstaller MessageQueueInstaller1;
private void InitializeComponent() {
    this.MessageQueueInstaller1 = new System.Messaging.MessageQueueInstaller();
    MessageQueueInstaller1.MaximumJournalSize = 4294967295;
    MessageQueueInstaller1.BasePriority = 0;
    MessageQueueInstaller1.Path = "server1\\OrdersReceived";
    this.Installers.Add(MessageQueueInstaller1);
}

You can manually edit the property values if there is a property that you want to set differently on the deployment computer. In addition to changing default property values, you can also override some of the default methods in the installation component if you want to change the processing that occurs during installation. For more information, see How to: Override Default Methods on Installation Components.

To change the default values for an installation component

  1. After adding an installation component to your solution, open the Installer1 class.

  2. Locate the installation component you want to modify, and access it in the Code Editor.

  3. Locate the InitializeComponent procedure. The default property values for your component are located within this procedure.

  4. Make any changes you need to make to the property values that will be used to create your component.

See Also

Tasks

How to: Add Installation Components to Your Projects
How to: Override Default Methods on Installation Components