Export (0) Print
Expand All
1 out of 2 rated this helpful - Rate this topic

Installer.Rollback Method

When overridden in a derived class, restores the pre-installation state of the computer.

[Visual Basic]
Public Overridable Sub Rollback( _
   ByVal savedState As IDictionary _
)
[C#]
public virtual void Rollback(
 IDictionary savedState
);
[C++]
public: virtual void Rollback(
 IDictionary* savedState
);
[JScript]
public function Rollback(
   savedState : IDictionary
);

Parameters

savedState
An IDictionary that contains the pre-installation state of the computer.

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 Rollback phase of the installation. This exception is ignored and the rollback continues. However, the computer might not be fully reverted to its initial state after the rollback completes.

Remarks

Notes to Inheritors:  When you override the Rollback method in a derived class, be sure to call the base class's Rollback method first in your derived method. A rollback operation restores the computer to the state it was in before the installations occurred. The Rollback method is called if the Install method of this instance of Installer, or any installer in the installer collection, fail to run correctly. Any exceptions generated by calling the Rollback methods of the installers in the installer collection are ignored and the rollback of the other installers continues.

Example

[Visual Basic, C#, C++] The following example demonstrates the Rollback method of Installer. The Rollback method is overridden in the derived class of Installer. An exception is generated to force an installation rollback.

[Visual Basic] 
' Override 'Rollback' method of Installer class.
Public Overrides Sub Rollback(mySavedState As IDictionary)
   MyBase.Rollback(mySavedState)
   Console.WriteLine("The Rollback method of 'MyInstallerSample'" + _
                                                " has been called")
End Sub 'Rollback

[C#] 
// Override 'Rollback' method of Installer class.
public override void Rollback( IDictionary mySavedState )
{
   base.Rollback( mySavedState );
   Console.WriteLine( "The Rollback method of 'MyInstallerSample'" +
                     " has been called" );
}

[C++] 
// Override 'Rollback' method of Installer class.
void Rollback(IDictionary* mySavedState) {
    Installer::Rollback(mySavedState);
    Console::WriteLine(S"The Rollback 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.

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: 

See Also

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

Show:
© 2014 Microsoft. All rights reserved.