Installer.Rollback(IDictionary) 方法


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

 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)



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.


下面的示例演示的 Rollback 方法 InstallerThe following example demonstrates the Rollback method of Installer. Rollback方法在的派生类中被重写 InstallerThe 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.
   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)
   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)如果 Install(IDictionary) 此实例的方法 Installer 或安装程序集合中的任何安装程序无法正常运行,则调用方法。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.