Installer.Commit(IDictionary) 方法


在派生类中重写时,完成安装事务。When overridden in a derived class, completes the install transaction.

 virtual void Commit(System::Collections::IDictionary ^ savedState);
public virtual void Commit (System.Collections.IDictionary savedState);
abstract member Commit : System.Collections.IDictionary -> unit
override this.Commit : System.Collections.IDictionary -> unit
Public Overridable Sub Commit (savedState As IDictionary)



IDictionary 包含在集合中所有安装程序都运行后的计算机的状态。An IDictionary that contains the state of the computer after all the installers in the collection have run.


savedState 参数为 nullThe savedState parameter is null.

- 或 --or- 保存的状态 IDictionary 可能已损坏。The saved-state IDictionary might have been corrupted.

在安装的 Commit(IDictionary) 阶段发生异常。An exception occurred during the Commit(IDictionary) phase of the installation. 忽略该异常,安装继续进行。This exception is ignored and the installation continues. 但是在安装完成后,应用程序可能无法正常工作。However, the application might not function correctly after the installation is complete.


下面的示例演示了 Commit 类的方法 InstallerThe following example demonstrates the Commit method of the Installer class. 类派生自 Installer 基类, Commit 方法被重写。A class is derived from the Installer base class and the Commit method are overridden.

// Override the 'Commit' method of the Installer class.
virtual void Commit( IDictionary^ mySavedState ) override
   Installer::Commit( mySavedState );
   Console::WriteLine( "The Commit method of 'MyInstallerSample' "
      "has been called" );
// Override the 'Commit' method of the Installer class.
public override void Commit( IDictionary mySavedState )
   base.Commit( mySavedState );
   Console.WriteLine( "The Commit method of 'MyInstallerSample'"
                     + "has been called" );
' Override the 'Commit' method of the Installer class.
Public Overrides Sub Commit(mySavedState As IDictionary)
   Console.WriteLine("The Commit method of 'MyInstallerSample'" + _
                                                "has been called")
End Sub


如果在 Commit(IDictionary) 派生类中重写方法,请确保 Commit(IDictionary) 先在派生方法中调用基类的方法。If you override the Commit(IDictionary) method in a derived class, be sure to call the base class's Commit(IDictionary) method first in your derived method. Commit(IDictionary)仅当 Install(IDictionary) 此实例中的每个安装程序的方法成功时,才会调用方法 InstallerCollectionThe Commit(IDictionary) method is called only if the Install(IDictionary) method of each installer in this instance's InstallerCollection succeeds. Commit(IDictionary)方法存储执行正确卸载所需的信息,并调用 Commit(IDictionary) 集合中每个安装程序的方法。The Commit(IDictionary) method stores information needed to do a correct uninstallation, and calls the Commit(IDictionary) method of each installer in the collection.