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.

注意

IDictionary savedState雖然和方法Commit會在安裝後儲存電腦的狀態,但在安裝完成後的某個時間點可能已刪除包含來自參數的檔案。 InstallAlthough 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參數為。 nullIf the file is deleted, the savedState parameter is null.

適用於