Search code examples
wixwindows-installerwix3.7

Unable to uninstall the application which is installed using wix installer


I have used wix installer to create an installer for my c# application.

Installation happened fine, but I am not able to uninstall the application. I see below the logs

MSI (s) (78:AC) [15:32:06:199]: Machine policy value 'Debug' is 0
MSI (s) (78:AC) [15:32:06:199]: ******* RunEngine:
       ******* Product: C:\wix\Installer\\bin\Debug\MyService-Debug-x86.msi
       ******* Action: 
       ******* CommandLine: **********
MSI (s) (78:AC) [15:32:06:207]: Machine policy value 'DisableUserInstalls' is 0
MSI (s) (78:AC) [15:32:06:326]: Note: 1: 2203 2: 
C:\Windows\Installer\inprogressinstallinfo.ipi 3: -2147287038 
MSI (s) (78:AC) [15:32:06:327]: Machine policy value 
'LimitSystemRestoreCheckpointing' is 0 
MSI (s) (78:AC) [15:32:06:327]: Note: 1: 1717 2: My Service (32bit) 
MSI (s) (78:AC) [15:32:06:327]: Note: 1: 2205 2:  3: Error 
MSI (s) (78:AC) [15:32:06:327]: Note: 1: 2228 2:  3: Error 4: SELECT 
`Message` FROM `Error` WHERE `Error` = 1717 
MSI (s) (78:AC) [15:32:06:327]: Calling SRSetRestorePoint API. 
dwRestorePtType: 1, dwEventType: 102, llSequenceNumber: 0, szDescription: 
"Removed My Service (32bit)".
MSI (s) (78:AC) [15:32:06:330]: The System Restore service is disabled. 
Returned status: 1058. GetLastError() returned: 1058
MSI (s) (78:AC) [15:32:06:332]: File will have security applied from OpCode.
MSI (s) (78:AC) [15:32:06:362]: SOFTWARE RESTRICTION POLICY: Verifying 
package --> 'C:\wix\Installer\\bin\Debug\MyService-Debug-x86.msi' against 
software restriction policy
MSI (s) (78:AC) [15:32:06:363]: Note: 1: 2262 2: DigitalSignature 3: 
-2147287038 
MSI (s) (78:AC) [15:32:06:363]: SOFTWARE RESTRICTION POLICY: 
C:\wix\Installer\\bin\Debug\MyService-Debug-x86.msi is not digitally signed
MSI (s) (78:AC) [15:32:06:365]: SOFTWARE RESTRICTION POLICY: 
C:\wix\Installer\\bin\Debug\MyService-Debug-x86.msi is permitted to run at 
the 'unrestricted' authorization level.
MSI (s) (78:AC) [15:32:06:366]: MSCOREE not loaded loading copy from 
system32
MSI (s) (78:AC) [15:32:06:374]: End dialog not enabled
MSI (s) (78:AC) [15:32:06:374]: Original package ==> 
C:\wix\Installer\\bin\Debug\MyService-Debug-x86.msi
MSI (s) (78:AC) [15:32:06:374]: Package we're running from ==> 
C:\Windows\Installer\152e2e.msi

While creating an installer, I never thought of digitally signing and all. Is it anything to do with signing? Totaly lost and need help

I have even tried with running uninstallation using the command line (admin mode) but no luck

msiexec.exe /x "C:\wix\Installer\\bin\Debug\MyService-Debug-x86.msi" /L*V "C:\work\wix.log"

it says

Another version of this product is already installed. Installation of this version cannot continue. To configure or remove the existing version of this product, use Add/Remove Programs on the Control Panel.

I might have to rebuild the installer code before uninstalling. Is it possible that some "guid" has changed related to the installer? anything I have to check inside registry?

Updated the question with Wix Code

The issue started appearing after I added custom actions. The responsibility of custom action is to get parameters from the installer and update the appsettings.json. but this uninstallation issue not allowing me to continue implementation.

  <Property Id="APPLICATIONLOG.PATHFORMAT"  Secure="yes"/>

  <Binary Id="CustomActionDLL" 
          SourceFile="..\..\Installer\CustomActions\bin\$(var.Configuration)\CustomAction.CA.dll" />

  <CustomAction Id="SetPropertyAppLogPathId"
                Property="SetPropertyAppLogPathProperty"
                Value="APPLICATIONLOG.PATHFORMAT=[APPLICATIONLOG.PATHFORMAT]"/>

  <CustomAction Id="SetPropertyAppLogPathProperty"
                BinaryKey="CustomActionDLL"
                DllEntry="UpdateConfigurationsAction"
                Execute="deferred"
                Return="check"
                Impersonate="no" />

  <InstallExecuteSequence>
    <Custom Action="SetPropertyAppLogPathId" Before="SetPropertyAppLogPathProperty"><![CDATA[NOT Installed]]></Custom>
    <Custom Action="SetPropertyAppLogPathProperty" After="InstallFiles"></Custom>
  </InstallExecuteSequence>

My Custom Action c# code

public class CustomActions
{
    public static string ApplicationPath { get; private set; }

    [CustomAction]
    public static ActionResult UpdateConfigurationsAction(Session session)
    {
        try
        {
            session.Log("Begin UpdateConfigurationsAction");
            ApplicationPath = session.CustomActionData["APPLICATIONLOG.PATHFORMAT"];
            session.Log("Application Log Path is: " + ApplicationPath);
            return ActionResult.Success;
        }
        catch (Exception e)
        {
            session.Log("Error in UpdateConfigurationsAction  " + e.Message);
            return ActionResult.Failure;
        }

    }
}

Issue Resolved

The issue was with the custom action. After making proper InstallExecuteSequence it worked!

Will update in solution section


Solution

  • Cross-Link: How to clean out broken uninstalls.


    Microsoft FixIt: Before trying anything else, perhaps try the Microsoft FixIt tool to see if you can get rid of any dangling installations. If unsuccessful check further down for other approaches.

    Debugging & Logging: Next fix your custom action in the package based on custom action debugging (I recommend the Advanced Installer MSI CA debugging video, it is quick and a good "hello debugger" session) and gathering logging information.

    Countermeasure: Finally, maybe add a property to suppress the custom action from running as described here ("Adding Condition" section).

    • This is the simplest idea I know of to suppress custom actions from running on uninstall - you just set the property involved when needed to suppress the custom action if it crashes. >
    • I would use it for all my custom actions - in fact - so I can suppress them all (or maybe one by one) - especially for uninstall scenarios where you run into "catch 22" situations (unable to install, upgrade or uninstall due to custom action bugs).

    Dangling Installations: In order to detect all related, dangling installations (if any), you can use this approach: Unable to uninstall program from WiX created MSI (enumerate all products with the same upgrade code).


    I will add these links for now in case you find that dangling version:

    When trying to remove an MSI which crashes on uninstall, the central question is how many computers are involved? If it is just one, then hacking the cached MSI database may be acceptable, otherwise you should create a patch package to fix the uninstall sequence and then trigger uninstall the normal way.


    Links: