无法卸载使用 wix 安装程序安装的应用程序

Unable to uninstall the application which is installed using wix installer

我已经使用 wix 安装程序为我的 c# 应用程序创建了一个安装程序。

安装顺利,但我无法卸载该应用程序。我在日志下面看到

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\Installer2e2e.msi

在创建安装程序时,我从未想过数字签名等等。跟签到有关系吗?完全迷路了,需要帮助

我什至尝试过 运行 uninstallation 使用命令行(管理员模式)但没有成功

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

它说

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.

我可能必须在卸载前重建安装程序代码。是否有可能某些 "guid" 已更改与安装程序相关? registry?

我有什么需要检查的吗

用 Wix 代码更新了问题

在我添加自定义操作后问题开始出现。自定义操作的职责是从安装程序获取参数并更新 appsettings.json。但是这个卸载问题不允许我继续实施。

  <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>

我的自定义操作 c# 代码

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;
        }

    }
}

问题已解决

问题出在自定义操作上。在进行适当的 InstallExecuteSequence 后它起作用了!

将在解决方案部分更新

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 (I recommend the Advanced Installer MSI CA debugging video, it is quick and a good "hello debugger" session) and .

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).

悬挂安装:为了检测所有相关的悬挂安装(如果有),您可以使用这种方法:Unable to uninstall program from WiX created MSI(枚举具有相同升级代码的所有产品)。


我现在会添加这些 links 以防你发现悬空版本:

  • wix - custom action dialogbox on silent uninstall of application
  • I screwed up, how can I uninstall my program?

当尝试删除在卸载时崩溃的 MSI 时,核心问题是涉及多少台计算机?如果只是一个,那么破解缓存的MSI数据库可能是可以接受的,否则你应该创建一个补丁包来修复卸载顺序,然后以正常方式触发卸载。


链接:

  • 再投一个 link:。可以按用户或按机器安装。