Advertisement

01.04.2008 at 04:32AM PST, ID: 23058315
[x]
Attachment Details

.NET deployment will not uninstall without repairing first

Asked by lgxsupport in Microsoft Visual C#.Net, .NET Framework 2.0, MSI

Tags: C#, Save state is required to uninstall this application, please repair and try again.

I have a problem with a .Net 2 developed deployment project.

The installer has to register various COM+ components among other things, so has a registration helper class implemented in the appropriate assemblies with custom actions configured in the deployment project to make use of them.
The installer correctly installs the software, but fails to uninstall it without first performing a Repair - the following error is reported by windows installer:

Save state is required to uninstall this application, please repair and try again.
Parameter name: savedState

As you can see from the code snippet attached, this error is being reported as the uninstall override of the custom action is receiving a null savedState parameter when called.

Note: Checking the install folder after installing the software shows the existence of an assemblyName.InstallState file. Nothing changes in the install folder during the repair.Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
public override void Install(System.Collections.IDictionary stateSaver)
        {
            base.Install(stateSaver);
 
            RegistrationConfig rc = new RegistrationConfig();
            rc.AssemblyFile = GetType().Assembly.Location;
            rc.ApplicationRootDirectory = System.IO.Path.GetDirectoryName(Context.Parameters["assemblypath"]);
            rc.InstallationFlags = InstallationFlags.FindOrCreateTargetApplication;
            RegistrationHelper regHelper = new RegistrationHelper();
            regHelper.InstallAssemblyFromConfig(ref rc);
 
            // Save the state - you will need this for the uninstall
            stateSaver.Add("AppID", rc.Application);
            stateSaver.Add("Assembly", rc.AssemblyFile);
        }
 
        public override void Uninstall(System.Collections.IDictionary savedState)
        {
            if (savedState == null)
                throw new ArgumentNullException("savedState", "Saved State is required to uninstall this application, please repair and try again");
 
            base.Uninstall(savedState);
 
            // Get the state created when the app was installed
            string appID = (string)savedState["AppID"];
            string assembly = (string)savedState["Assembly"];
            // Uninstall the application
            RegistrationHelper regHelper = new RegistrationHelper();
            regHelper.UninstallAssembly(assembly, appID);
 
        }
[+][-]01.24.2008 at 07:52AM PST, ID: 20734076

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Microsoft Visual C#.Net, .NET Framework 2.0, MSI
Tags: C#, Save state is required to uninstall this application, please repair and try again.
Sign Up Now!
Solution Provided By: ShazbotOK
Participating Experts: 1
Solution Grade: A
 
 
[+][-]05.22.2008 at 02:45AM PDT, ID: 21622217

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]05.26.2008 at 05:26AM PDT, ID: 21646014

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628