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



我已经使用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:wixInstaller\binDebugMyService-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:WindowsInstallerinprogressinstallinfo.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:wixInstaller\binDebugMyService-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:wixInstaller\binDebugMyService-Debug-x86.msi is not digitally signed
MSI (s) (78:AC) [15:32:06:365]: SOFTWARE RESTRICTION POLICY: 
C:wixInstaller\binDebugMyService-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:wixInstaller\binDebugMyService-Debug-x86.msi
MSI (s) (78:AC) [15:32:06:374]: Package we're running from ==> 
C:WindowsInstaller152e2e.msi

创建安装程序时,我从未想过数字签名和所有签名。与签名有什么关系吗?完全失去了,需要帮助

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

msiexec.exe /x "C:wixInstaller\binDebugMyService-Debug-x86.msi" /L*V "C:workwix.log"

它说

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

我可能必须在卸载之前重建安装程序代码。某些" GUID"是否可能与安装程序有关?我必须在registry中检查什么?

使用Wix代码

更新了问题

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

  <Property Id="APPLICATIONLOG.PATHFORMAT"  Secure="yes"/>
  <Binary Id="CustomActionDLL" 
          SourceFile="....InstallerCustomActionsbin$(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;
        }
    }
}

问题已解决

问题在于自定义操作。制作适当的issallexecutesequence后,它起作用了!

将在解决方案部分中更新

交叉链接 :如何清理损坏的卸载。


Microsoft FixIt :尝试其他任何方法之前,也许尝试 Microsoft FixIt工具查看您是否可以摆脱任何 悬挂装置。如果不成功,请进一步检查其他 接近。

调试&amp;记录 :下一步修复基于自定义操作调试的包装中的自定义操作(我建议 the Advanced Installer MSI CA debugging video ,它是快速且很好的" Hello debugger"会话(并收集记录记录信息。

对策 :最后,也许添加一个属性来抑制此处所述运行的自定义操作("Adding Condition"节(。

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

悬挂装置 :为了检测所有相关的,悬挂的安装(如果有(,您可以使用此方法:无法从WIX创建的MSI卸载程序(枚举所有具有相同升级代码的产品(。


,如果您发现悬挂版本:

,我将添加这些链接
  • Wix-静音卸载应用程序
  • 上的自定义动作对话框
  • 我搞砸了,我该如何卸载我的程序?

试图删除在卸载上崩溃的MSI时,核心问题是涉及多少计算机?如果仅仅是一个,则可以接受攻击的MSI数据库,否则您应该创建一个补丁程序包来修复卸载序列,然后触发正常方式卸载。


链接

  • 投掷另一个链接:Wix不会卸载较旧版本。可以安装每用户或每台安装。