See Also: Installer Members
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 System.Configuration.Install.Installer:
Inherit the System.Configuration.Install.Installer class.
Override the Installer.Install(IDictionary), Installer.Commit(IDictionary), Installer.Rollback(IDictionary), and Installer.Uninstall(IDictionary) methods.
Add the System.ComponentModel.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 Installer.Installers property contains a collection of installers. If this instance of System.Configuration.Install.Installer is part of an installer collection, the Installer.Parent property is set to the System.Configuration.Install.Installer instance that contains the collection. For an example of the use of the Installer.Installers collection, see the System.Configuration.Install.AssemblyInstaller class.
The Installer.Install(IDictionary), Installer.Commit(IDictionary), Installer.Rollback(IDictionary), and Installer.Uninstall(IDictionary) methods of the System.Configuration.Install.Installer class go through the collection of installers stored in the Installer.Installers property, and invokes the corresponding method of each installer.
The Installer.Install(IDictionary), Installer.Commit(IDictionary), Installer.Rollback(IDictionary), and Installer.Uninstall(IDictionary) methods are not always called on the same System.Configuration.Install.Installer instance. For example, one System.Configuration.Install.Installer 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 System.Configuration.Install.Installer instance, meaning that the Installer.Uninstall(IDictionary) method is called by a different instance of System.Configuration.Install.Installer. 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 Installer.Install(IDictionary), Installer.Commit(IDictionary), Installer.Rollback(IDictionary), and Installer.Uninstall(IDictionary) 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 Installer.Uninstall(IDictionary) method, and the command line that was entered when the installation executable was run.