简体   繁体   English

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

[英]Unable to uninstall the application which is installed using wix installer

I have used wix installer to create an installer for my c# application.我已经使用wix安装程序为我的c#应用程序创建了一个安装程序。

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我什至尝试过使用命令行(管理模式)运行uninstallation但没有运气

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?是否有可能与安装程序相关的某些“guid”发生了变化? anything I have to check inside registry ?我必须在registry检查什么?

Updated the question with Wix Code使用 Wix 代码更新了问题

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.自定义操作的职责是从安装程序获取参数并更新 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我的自定义操作 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;
        }

    }
}

Issue Resolved问题解决了

The issue was with the custom action.问题出在自定义操作上。 After making proper InstallExecuteSequence it worked!制作正确的 InstallExecuteSequence 后,它起作用了!

Will update in solution section将在解决方案部分更新

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. Microsoft FixIt :在尝试其他任何事情之前,也许可以尝试使用Microsoft FixIt 工具,看看您是否可以摆脱任何悬而未决的安装。 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 .调试和日志记录:接下来根据自定义操作调试(我推荐the Advanced Installer MSI CA debugging video ,这是一个快速且不错的“hello debugger”会话)和收集日志信息来修复包中的自定义操作

Countermeasure : Finally, maybe add a property to suppress the custom action from running as described here ( "Adding Condition" section).对策:最后,可以添加一个属性来抑制自定义操作的运行,如此处所述"Adding Condition"部分)。

  • 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).我会将它用于我所有的自定义操作 - 事实上 - 所以我可以将它们全部(或者可能一个一个)抑制 - 特别是对于遇到“catch 22”情况(由于以下原因无法安装,升级或卸载)的卸载场景自定义操作错误)。

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).悬空安装:为了检测所有相关的悬空安装(如果有),您可以使用以下方法: 无法从 WiX 创建的 MSI 卸载程序(枚举所有具有相同升级代码的产品)。


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


Links :链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM