Export (0) Print
Expand All
4 out of 24 rated this helpful - Rate this topic

Installer.Uninstall Method

When overridden in a derived class, removes an installation.

Namespace: System.Configuration.Install
Assembly: System.Configuration.Install (in system.configuration.install.dll)

public virtual void Uninstall (
	IDictionary savedState
)
public void Uninstall (
	IDictionary savedState
)
public function Uninstall (
	savedState : IDictionary
)

Parameters

savedState

An IDictionary that contains the state of the computer after the installation was complete.

Exception typeCondition

ArgumentException

The saved-state IDictionary might have been corrupted.

InstallException

An exception occurred while uninstalling. This exception is ignored and the uninstall continues. However, the application might not be fully uninstalled after the uninstallation completes.

Notes to Inheritors When you override the Uninstall method in a derived class, be sure to call the base class's Uninstall method first in your derived method. The Uninstall method is called to remove a previously completed installation. If the uninstallation fails for one installer in the collection, the remaining installers are still uninstalled. A failed uninstallation does not roll back the computer to its pre-uninstallation state. 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. If the file is deleted, the savedState parameter is a null reference (Nothing in Visual Basic). Your Uninstall method should be able to handle the case of a null reference (Nothing in Visual Basic)savedState parameter.

The following example demonstrates the Uninstall method of Installer. The Uninstall method is overridden in the derived class of Installer.

// Override 'Uninstall' method of Installer class.
public override void Uninstall( IDictionary mySavedState )
{  
   if (mySavedState == null)
   {
      Console.WriteLine("Uninstallation Error !");
   
   else
   {
      base.Uninstall( mySavedState );
      Console.WriteLine( "The Uninstall method of 'MyInstallerSample' has been called" );
   


// Override 'Uninstall' method of Installer class.
public void Uninstall(IDictionary mySavedState)
{
    if (mySavedState.Equals(null)) {
        Console.WriteLine("Uninstallation Error !");
    
    else {
        super.Uninstall(mySavedState);
        Console.WriteLine("The Uninstall method of 'MyInstallerSample'"
            +" has been called");
    
 //Uninstall

  • Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see .

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.