Installer.Rollback(IDictionary) Installer.Rollback(IDictionary) Installer.Rollback(IDictionary) Installer.Rollback(IDictionary) Method

定义

在派生类中重写时,还原计算机的安装前状态。When overridden in a derived class, restores the pre-installation state of the computer.

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

参数

savedState
IDictionary IDictionary IDictionary IDictionary

IDictionary,它包含计算机的安装前状态。An IDictionary that contains the pre-installation state of the computer.

异常

savedState 参数为 nullThe savedState parameter is null.

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

在安装的 Rollback(IDictionary) 阶段发生异常。An exception occurred during the Rollback(IDictionary) 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.

示例

下面的示例演示RollbackInstaller方法。The following example demonstrates the Rollback method of Installer. 方法在的Installer派生类中被重写。 RollbackThe Rollback method is overridden in the derived class of Installer. 系统会生成一个例外, 强制执行回滚。An exception is generated to force an installation rollback.

   // Override 'Rollback' method of Installer class.
public:
   virtual void Rollback( IDictionary^ mySavedState ) override
   {
      Installer::Rollback( mySavedState );
      Console::WriteLine( "The Rollback method of 'MyInstallerSample'" +
                         " has been called" );
   }
// 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" );
}
' 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(IDictionary)重写方法时, 请确保先在派生方法中调用基类Rollback(IDictionary)的方法。When you override the Rollback(IDictionary) method in a derived class, be sure to call the base class's Rollback(IDictionary) method first in your derived method. 回滚操作将计算机还原到安装前的状态。A rollback operation restores the computer to the state it was in before the installations occurred. 如果此实例的Rollback(IDictionary) Installer方法或安装程序集合中的任何安装程序无法正常运行, 则调用方法。 Install(IDictionary)The Rollback(IDictionary) method is called if the Install(IDictionary) method of this instance of Installer, or any installer in the installer collection, fail to run correctly. 通过调用Rollback(IDictionary)安装程序集合中的安装程序方法生成的任何异常都将被忽略, 并且其他安装程序的回滚将继续。Any exceptions generated by calling the Rollback(IDictionary) methods of the installers in the installer collection are ignored and the rollback of the other installers continues.

适用于

另请参阅