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 Installer類別的方法。The 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. 只有在這個實例中的每Install(IDictionary)InstallerCollection安裝程式的方法都成功時, 才會呼叫方法。Commit(IDictionary)The 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.