Commit Method

Installer.Commit Method

When overridden in a derived class, completes the install transaction.

[Visual Basic]
Public Overridable Sub Commit( _
   ByVal savedState As IDictionary _
public virtual void Commit(
 IDictionary savedState
public: virtual void Commit(
 IDictionary* savedState
public function Commit(
   savedState : IDictionary


An IDictionary that contains the state of the computer after all the installers in the collection have run.


Exception Type Condition
ArgumentException The savedState parameter is a null reference (Nothing in Visual Basic).


The saved-state IDictionary might have been corrupted.

InstallException An exception occurred during the Commit phase of the installation. This exception is ignored and the installation continues. However, the application might not function correctly after the installation is complete.


Notes to Inheritors:  If you override the Commit method in a derived class, be sure to call the base class's Commit method first in your derived method. The Commit method is called only if the Install method of each installer in this instance's InstallerCollection succeeds. The Commit method stores information needed to do a correct uninstallation, and calls the Commit method of each installer in the collection.


[Visual Basic, C#, C++] The following example demonstrates the Commit method of the Installer class. A class is derived from the Installer base class and the Commit method are overridden.

[Visual Basic] 
' 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

// 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.
void Commit(IDictionary* mySavedState) {
    Console::WriteLine(S"The Commit method of 'MyInstallerSample' has been called");

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

.NET Framework Security: 

See Also

Installer Class | Installer Members | System.Configuration.Install Namespace | Install | Uninstall | Rollback | InstallerCollection | Installers

© 2016 Microsoft