Installer.Commit Method
When overridden in a derived class, completes the install transaction.
[Visual Basic] Public Overridable Sub Commit( _ ByVal savedState As IDictionary _ ) [C#] public virtual void Commit( IDictionary savedState ); [C++] public: virtual void Commit( IDictionary* savedState ); [JScript] public function Commit( savedState : IDictionary );
Parameters
- savedState
- An IDictionary that contains the state of the computer after all the installers in the collection have run.
Exceptions
| Exception Type | Condition |
|---|---|
| ArgumentException | The savedState parameter is a null reference (Nothing in Visual Basic).
-or- 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. |
Remarks
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.
Example
[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) MyBase.Commit(mySavedState) Console.WriteLine("The Commit method of 'MyInstallerSample'" + _ "has been called") End Sub 'Commit [C#] // 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" ); } [C++] // Override the 'Commit' method of the Installer class. void Commit(IDictionary* mySavedState) { Installer::Commit(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
in the upper-left corner of the page.
Requirements
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:
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries From Partially Trusted Code
See Also
Installer Class | Installer Members | System.Configuration.Install Namespace | Install | Uninstall | Rollback | InstallerCollection | Installers