System.Configuration.Install 命名空间

System.Configuration.Install 命名空间提供类,这些类使您可以为自己的组件编写自定义安装程序。 The System.Configuration.Install namespace provides classes that allow you to write custom installers for your own components. Installer 类是 .NET Framework 中所有自定义安装程序的基类。 The Installer class is the base class for all custom installers in the .NET Framework.

AssemblyInstaller

加载一个程序集,并运行其中的所有安装程序。Loads an assembly, and runs all the installers in it.

ComponentInstaller

指定一个安装程序,该程序从组件复制属性以供安装时使用。Specifies an installer that copies properties from a component to use at install time.

InstallContext

包含关于当前安装的信息。Contains information about the current installation.

Installer

提供自定义安装的基础。Provides the foundation for custom installations.

InstallerCollection

包含要在安装过程中运行的安装程序的集合。Contains a collection of installers to be run during an installation.

InstallEventArgs

为下列事件提供数据:BeforeInstallAfterInstallCommittingCommittedBeforeRollbackAfterRollbackBeforeUninstallAfterUninstallProvides data for the events: BeforeInstall, AfterInstall, Committing, Committed, BeforeRollback, AfterRollback, BeforeUninstall, AfterUninstall.

InstallException

在安装的提交、回滚或卸载阶段发生错误时引发的异常。The exception that is thrown when an error occurs during the commit, rollback, or uninstall phase of an installation.

ManagedInstallerClass

表示托管安装。Represents a managed install.

TransactedInstaller

定义要么完全成功要么失败后将计算机保留在其初始状态的安装程序。Defines an installer that either succeeds completely or fails and leaves the computer in its initial state.

接口

IManagedInstaller

为托管安装程序提供一个接口。Provides an interface for a managed installer.

枚举

UninstallAction

指定安装程序在卸载时应进行的操作。Specifies what an installer should do during an uninstallation.

委托

InstallEventHandler

代表将处理 BeforeInstallAfterInstallCommittingCommittedBeforeRollbackAfterRollbackBeforeUninstallAfterUninstallInstaller 事件的方法。Represents the method that will handle the BeforeInstall, AfterInstall, Committing, Committed, BeforeRollback, AfterRollback, BeforeUninstall, or AfterUninstall event of an Installer.

注解

通过Installers属性,安装程序包含其他程序作为子级的集合。Through the Installers property, an installer contains a collection of other installers as children. 执行安装程序,它将循环浏览其子级,并调用InstallCommitRollback,或UninstallAs the installer is executed, it cycles through its children and calls Install, Commit, Rollback, or Uninstall. 有关中的对象的示例Installers集合,请参阅EventLogInstallerFor an example of an object in the Installers collection, see EventLogInstaller.

Context属性包含有关安装的信息。The Context property contains information about the installation. 例如,安装过程中,将保存所需的信息的文件的位置的日志文件的位置有关的信息Uninstall方法,以及运行可执行安装时已输入的命令行。For example, information about the location of the log file for the installation, the location of the file that saves information required by the Uninstall method, and the command line that was entered when the installation executable was run. 执行安装文件的示例,请参阅Installutil.exe (安装程序工具)For an example of an installation executable, see Installutil.exe (Installer Tool).

InstallCommitRollback,和Uninstall方法不会在同一个实例上始终调用InstallerThe Install, Commit, Rollback, and Uninstall methods are not always called on the same instance of Installer. 例如,可以使用Installer以安装和提交应用程序,然后释放对该InstallerFor example, you might use an Installer to install and commit an application, and then release the reference to that Installer. 更高版本,卸载应用程序创建的新引用Installer,这意味着Uninstall的不同实例上调用方法InstallerLater, uninstalling the application creates a new reference to an Installer, which means that the Uninstall method is called on a different instance of Installer. 出于此原因,不要在安装程序中保存的计算机的状态。For this reason, do not save the state of a computer in an installer. 请改用IDictionary,它是在调用之间保留并传入InstallCommitRollback,和Uninstall方法。Instead, use an IDictionary that is preserved across calls and passed into the Install, Commit, Rollback, and Uninstall methods.