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

时间:2019-08-06 10:18:05

标签: wix windows-installer wix3.7

我已经使用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\Installer\152e2e.msi

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

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

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

  

已经安装了该产品的另一个版本。无法继续安装此版本。要配置或删除该产品的现有版本,请使用“控制面板”上的“添加/删除程序”。

在卸载之前,我可能必须重建安装程序代码。是否有可能与安装程序相关的某些“指南”已更改?我需要在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后,它可以正常工作!

将在解决方案部分更新

1 个答案:

答案 0 :(得分:1)

  

Microsoft FixIt :在尝试其他任何操作之前,也许尝试使用Microsoft FixIt tool来看看是否可以摆脱任何麻烦   悬挂装置。如果不成功,请进一步检查其他   方法。

     

调试和日志记录 :接下来,根据custom action debugging(我建议使用the Advanced Installer MSI CA debugging video,在软件包中修复您的自定义操作,该操作既快捷又良好的“ hello调试器”会话)和gathering logging information

     

对策 :最后,也许是add a property to suppress the custom action from running as described here"Adding Condition"部分)。

     
      
  • 这是最简单的   我知道禁止在卸载时运行自定义操作的想法-您只需在需要时设置所涉及的属性,以在自定义操作崩溃时抑制它。 >
  •   
  • 实际上,我会将它用于我的所有自定义操作,因此我可以将其全部抑制(或   也许一个接一个)-特别是对于遇到"catch 22"情况(由于自定义操作错误而无法安装,升级或卸载)的卸载方案。
  •   

悬空安装 :为了检测所有相关的悬空安装(如果有),可以使用以下方法:Unable to uninstall program from WiX created MSI(将所有产品与相同的升级代码。


我现在将添加这些链接,以防您发现该悬挂版本:

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


链接