Provides the foundation for custom installations.
Assembly: System.Configuration.Install (in System.Configuration.Install.dll)
Gets a value indicating whether the component can raise an event.(Inherited from Component.)
Gets or sets information about the current installation.
Gets the help text for all the installers in the installer collection.
Gets the collection of installers that this installer contains.
Gets or sets the installer containing the collection that this installer belongs to.
When overridden in a derived class, completes the install transaction.
Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.(Inherited from MarshalByRefObject.)
Determines whether the specified object is equal to the current object.(Inherited from Object.)
Serves as the default hash function. (Inherited from Object.)
Retrieves the current lifetime service object that controls the lifetime policy for this instance.(Inherited from MarshalByRefObject.)
Obtains a lifetime service object to control the lifetime policy for this instance.(Inherited from MarshalByRefObject.)
When overridden in a derived class, performs the installation.
Raises the AfterInstall event.
Raises the AfterRollback event.
Raises the AfterUninstall event.
Raises the BeforeInstall event.
Raises the BeforeRollback event.
Raises the BeforeUninstall event.
Raises the Committed event.
Raises the Committing event.
When overridden in a derived class, restores the pre-installation state of the computer.
When overridden in a derived class, removes an installation.
Occurs after the installations of all the installers in the Installers property are rolled back.
Occurs after all the installers in the Installers property perform their uninstallation operations.
Occurs before the Install method of each installer in the installer collection has run.
Occurs before the installers in the Installers property are rolled back.
Occurs before the installers in the Installers property perform their uninstall operations.
Occurs after all the installers in the Installers property have committed their installations.
Occurs before the installers in the Installers property committ their installations.
This is the base class for all custom installers in the .NET Framework. Installers are components that help install applications on a computer.
There are several steps you must follow to use an:
Add the RunInstallerAttribute to your derived class and set it to true.
Put your derived class in the assembly with your application to install.
Invoke the installers. For example, use the InstallUtil.exe to invoke the installers.
The Installers property contains a collection of installers. If this instance of is part of an installer collection, the Parent property is set to the instance that contains the collection. For an example of the use of the Installers collection, see the AssemblyInstaller class.
The Install, Commit, Rollback, and Uninstall methods are not always called on the same instance. For example, one instance might be used while installing and committing an application, and then the reference to that instance is released. Later, uninstalling the application creates a reference to a new instance, meaning that the Uninstall method is called by a different instance of . For this reason, in your derived class, do not save the state of a computer in an installer. Instead, use an IDictionary that is preserved across calls and passed into your Install, Commit, Rollback, and Uninstall methods.
Two situations illustrate the need to save information in the state-saver IDictionary. First, suppose that your installer sets a registry key. It should save the key's original value in the IDictionary. If the installation is rolled back, the original value can be restored. Second, suppose the installer replaces an existing file. Save the existing file in a temporary directory and the location of the new location of the file in the IDictionary. If the installation is rolled back, the newer file is deleted and replaced by the original from the temporary location.
The Installer.Context property contains information about the installation. For example, information about the location of the log file for the installation, the location of the file to save information required by the Uninstall method, and the command line that was entered when the installation executable was run.
The following example demonstrates the use of the Commit is about to complete, Committing event occurs and a message is displayed. To use the class, you must reference the System.Configuration.Install assembly in your project.class. It creates a class which inherits from . When
Imports System Imports System.Collections Imports System.ComponentModel Imports System.Configuration.Install ' Set 'RunInstaller' attribute to true. <RunInstaller(True)> _ Public Class MyInstallerClass Inherits Installer Public Sub New() MyBase.New() ' Attach the 'Committed' event. AddHandler Me.Committed, AddressOf MyInstaller_Committed ' Attach the 'Committing' event. AddHandler Me.Committing, AddressOf MyInstaller_Committing End Sub 'NewNew ' Event handler for 'Committing' event. Private Sub MyInstaller_Committing(ByVal sender As Object, _ ByVal e As InstallEventArgs) Console.WriteLine("") Console.WriteLine("Committing Event occured.") Console.WriteLine("") End Sub 'MyInstaller_Committing ' Event handler for 'Committed' event. Private Sub MyInstaller_Committed(ByVal sender As Object, _ ByVal e As InstallEventArgs) Console.WriteLine("") Console.WriteLine("Committed Event occured.") Console.WriteLine("") End Sub 'MyInstaller_Committed ' Override the 'Install' method. Public Overrides Sub Install(ByVal savedState As IDictionary) MyBase.Install(savedState) End Sub 'Install ' Override the 'Commit' method. Public Overrides Sub Commit(ByVal savedState As IDictionary) MyBase.Commit(savedState) End Sub 'Commit ' Override the 'Rollback' method. Public Overrides Sub Rollback(ByVal savedState As IDictionary) MyBase.Rollback(savedState) End Sub 'Rollback Public Shared Sub Main() Console.WriteLine("Usage : installutil.exe Installer.exe ") End Sub 'Main End Class 'MyInstallerClass
Available since 1.1
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.