AssemblyInstaller.Uninstall(IDictionary) 方法
定义
移除安装。Removes an installation.
public:
override void Uninstall(System::Collections::IDictionary ^ savedState);
public override void Uninstall (System.Collections.IDictionary savedState);
override this.Uninstall : System.Collections.IDictionary -> unit
Public Overrides Sub Uninstall (savedState As IDictionary)
参数
- savedState
- IDictionary
IDictionary,它包含计算机的安装后状态。An IDictionary that contains the post-installation state of the computer.
例外
保存的状态 IDictionary 可能已损坏。The saved-state IDictionary might have been corrupted.
- 或 --or- 未能找到文件。A file could not be found.
该集合中的一个安装程序的 BeforeUninstall 事件处理程序出现错误。An error occurred in the BeforeUninstall event handler of one of the installers in the collection.
- 或 --or- 该集合中的一个安装程序的 AfterUninstall 事件处理程序出现错误。An error occurred in the AfterUninstall event handler of one of the installers in the collection.
- 或 --or- 卸载时发生异常。An exception occurred while uninstalling. 该异常被忽略,卸载继续进行。The exception is ignored and the uninstall continues. 但是,卸载完成后应用程序可能未完全卸载。However, the application might not be fully uninstalled after the uninstall completes.
- 或 --or- 在一个程序集中未找到安装程序类型。Installer types were not found in one of the assemblies.
- 或 --or- 未能创建一个安装程序类型的实例。An instance of one of the installer types could not be created.
- 或 --or- 未能删除文件。A file could not be deleted.
卸载时发生异常。An exception occurred while uninstalling. 该异常被忽略,卸载继续进行。The exception is ignored and the uninstall continues. 但是,卸载完成后应用程序可能未完全卸载。However, the application might not be fully uninstalled after the uninstall completes.
示例
在下面的示例中,在 Uninstall 安装并提交作为参数传递给构造函数的程序集后,将调用方法。In the following sample, the Uninstall method is called after installing and committing the assembly passed as the parameter to the constructor.
// Uninstall the 'MyAssembly_Uninstall' assembly.
myAssemblyInstaller->Uninstall( mySavedState );
// Uninstall the 'MyAssembly_Uninstall' assembly.
myAssemblyInstaller.Uninstall( mySavedState );
' Uninstall the 'MyAssembly_Uninstall' assembly.
myAssemblyInstaller.Uninstall(mySavedState)
注解
调用此方法可删除先前完成的安装。Call this method to remove a previously completed installation. 如果 Uninstall 集合中的某个安装程序的方法失败,仍将为其余的安装程序调用该方法。If the Uninstall method fails for one of the installers in the collection, it is still called for the remaining installers. 如果卸载失败,则不会将计算机回滚到其预卸载状态。A failed uninstallation does not roll back the computer to its pre-uninstallation state.
备注
尽管 Install 和 Commit 方法在安装之后保存计算机的状态,但在 IDictionary savedState 安装完成后,可能会在某个时间点删除包含参数的文件。Although the Install and Commit methods save the state of the computer after the installations, the file containing the IDictionary from the savedState parameter might have been deleted at some point after the installation was complete. 如果文件已删除,则 savedState 参数为 null 。If the file is deleted, the savedState parameter is null.