在完整的 ui 模式条件下卸载 msi(wix 工具集) [英] Uninstall msi with full ui mode condition (wix toolset)

查看:31
本文介绍了在完整的 ui 模式条件下卸载 msi(wix 工具集)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将以下内容添加到我的 WIX 模板中,以防止在我创建的自定义对话框中未输入值的情况下进行安装.

I've added the following to my WIX template to prevent installation without entering values in a custom dialog i've made.

    <Condition Message='This installation can only run in full UI mode.'>
        <![CDATA[UILevel = 5]]>
    </Condition>

当我尝试卸载应用程序时,我收到此消息,但无法继续.

When I try to uninstall the application I get this message, and I'm unable to proceed.

  1. 如何解决此问题,使其在卸载时不适用?

  1. How do I fix this so that it does not apply on uninstall?

如何强制卸载此应用程序?

How can I forcibly uninstall this application?

推荐答案

问题 1:LaunchCondition

LaunchConditions 必须始终评估为 true 才能安装/运行设置.这里有一些进一步的细节:失败条件 wix(推荐用于更多上下文).当您通过 Add/Remove Programs 调用卸载时,它会以静默模式运行安装程序(我相信 UILevel = 2UILevel = 3),这使您的 LaunchCondition 失败,因为 UILevel 不等于 5.

Question 1: LaunchCondition

LaunchConditions must always evaluate to true for the setup to be able to install / run. There are some further details here: Failing condition wix (recommended for more context). When you invoke uninstall via Add / Remove Programs it will run the installer in silent mode (I believe UILevel = 2 or UILevel = 3), which fails your LaunchCondition since UILevel is not equal to 5.

OR Installed:防止 LaunchConditions 在其他安装模式下触发问题而不是全新安装的常用技术是添加 或 安装 到有问题的 LaunchCondition.这将强制 LaunchCondition 对于已安装产品的所有情况和模式(modifyuninstallrepair 等...).

OR Installed: A common technique to prevent LaunchConditions to trigger problems in other installation modes than fresh install, is to add OR Installed to the LaunchCondition in question. This will force the LaunchCondition to be true for all situations and modes where the product is already installed (modify, uninstall, repair, etc...).

所以像这样的事情可能可以作为更新的条件:

So something like this could probably work as an updated condition:

Installed OR UILevel = 5

错误的方法?:话虽如此,我宁愿执行检查以确定您需要指定的值是否已通过 PUBLIC 属性在命令行上设置为静默安装,而不是那种相当奇怪的 LaunchCondition 检查设置的 GUI 级别.您仍然可以将其实现为 LaunchCondition - 或使用自定义操作以获得更大的灵活性.LaunchCondition 将检查所有关键设置参数的值,并且您将使用 OR Installed 机制阻止它们在卸载和其他模式下运行.以下是关于 静默安装transformspublic properties 主题的答案:如何更好地利用 MSI 文件(静默部署对于企业部署和软件验收).

Wrong Approach?: With that said I would rather implement a check to determine if the value you need specified has been set on the command line via PUBLIC properties for a silent install, instead of that rather strange LaunchCondition checking the setup's GUI level. You can still implement this as a LaunchCondition - or use a custom action for more flexibility. The LaunchCondition would check for values for all critical setup parameters, and you would prevent them from running on uninstall and other modes with the OR Installed mechanism. Here is an answer on the topic of silent installation, transforms and public properties: How to make better use of MSI files (silent deployment is crucial for corporate deployment and software acceptance).

更新:为了完整性,在底部列出了几个附加选项.

UPDATE: A couple of additional options listed towards the bottom for completeness.

2.1 - ARP 修改:在进入太多疯狂细节之前,我想运行您提供的最简单的选项.Modify 选项是否可用于您在 Add/Remove Programs 中的设置?如果是这样,请单击它并查看是否可以从设置的Modify dialogs 中选择删除.这应该可以工作(因为在选择 Modify 时您通常不会在静默模式下运行设置).

2.1 - ARP Modify: I want to run the simplest option by you before going into too much crazy detail. Is the Modify option available for your setup in Add / Remove Programs? If so, please click it and see if you then can select remove from the setup's Modify dialogs. This should work (since you are generally not running the setup in silent mode when choosing Modify).

2.2 - 交互式 msiexec.exe 卸载命令:我忘了补充一点,您应该能够通过命令行启动交互式卸载,如下所示:msiexec.exe/x {PRODUCT-GUID}/qf.以下是如何找到产品 GUID:如何找到已安装 MSI 设置的产品 G​​UID? 总结:您找到链接中所述的产品 G​​UID,然后打开一个cmd.exe 窗口并触发上面指示的卸载命令.

2.2 - Interactive msiexec.exe Uninstall Command: I forgot to add that you should be able to kick off an interactive uninstall via command line as follows: msiexec.exe /x {PRODUCT-GUID} /qf. Here is how you can find the product GUID: How can I find the product GUID of an installed MSI setup? So in summmary: you find the product GUID as explained in the link, and then you open a cmd.exe window and fire off the uninstall command indicated above.

2.3 - Microsoft FixIt:如果上面的第一个选项不可用,还有其他几个选项可以工作,但在尝试它们之前,我建议给 微软解决安装/卸载问题的 FixIt 工具 有机会看看这是否适合您.运行它,选择你的安装,看看是否有一些自动魔法可以让你卸载它.

2.3 - Microsoft FixIt: If the first option above is not available, there are several other options that could work, but before trying them I would recommend giving the Microsoft FixIt tool for installation / uninstallation problems a chance to see if this does the trick for you. Run it, select your installation and see if some auto-magic is there for you to get it uninstalled.

2.4 - 高级(尽可能避免)- hack system-cached MSI:如果上述方法失败,此答案将是下一步:我搞砸了,我该如何卸载我的程序? 如果上述方法不起作用,请告诉我们,我们将在此处检查选项.我只想压缩缓存的 MSI 并禁用启动条件,但如果您可以避免它,这对于舒适来说太麻烦了.

2.4 - Advanced (avoid if you can) - hack system-cached MSI: This answer will be the next step, if the above fails: I screwed up, how can I uninstall my program? Please let us know if the above does not work, and we will check the options here. I would just zip up the cached MSI and disable the launch condition, but this is way too hacky for comfort if you can avoid it.

UPDATE:添加了以下内容,但不是解决问题所必需的.不推荐,万不得已.保留内容.

UPDATE: The below was added, but not needed to solve the problem. It is not recommended, it is the last resort. Leaving the content in.

查找缓存的 MSI:您可以查找缓存的系统MSI 使用 Powershell,如此处所述.我将在此处内联 Powershell 命令:

Finding Cached MSI: you can find the system cached MSI using Powershell as explained here. I will inline the Powershell command here:

gwmi -Query "SELECT Name,LocalPackage FROM Win32_Product WHERE
IdentifyingNumber='{PRODUCT-GUID}'" | Format-Table Name,
LocalPackage

然后使用 Orca 或等效工具打开缓存文件(先备份它,或将其压缩),您可以进行任何需要的更改以使卸载正常运行.这通常不被认为是一种理智的方法——它是最后的手段.您在 MSI 中更改的内容取决于它出了什么问题.这需要专业的 MSI 知识.很容易搞砸,所以卸载变得更加困难.

You then open the cached file (make a backup of it first, or zip it) with Orca or an equivalent tool, and you make whatever change needed to get the uninstall to function correctly. This is not generally considered a sane approach - it is the last resort. And what you change in the MSI is different depending on what is wrong with it. This requires specialist MSI knowledge. It is easy to mess things up so uninstall becomes even more difficult.

我刚看到你在写这篇文章时卸载了产品.呸!很高兴您不需要后一种方法.我想我会提交它并将其设置为三振,因此它是可见的但不推荐(如果只是为了我自己在需要时重复使用).

I just saw you got the product uninstalled whilst writing this. Puh! Be glad you don't need this latter approach. I think I will commit it and set it to strikeout so it is visible but not recommended (if only for myself to reuse if needed).

更新,一些额外的替代方案(并不总是适用,包括供参考和潜在的重用):1) 如果您有权访问用于安装的原始 MSI您的软件(它必须是用于安装的 MSI 的精确副本),然后您可以尝试双击它,这将直接带您进行修改.2) 如果您不再有原始安装的MSI,您也可以双击系统缓存文件夹中的文件.3) 可能您也可以修补注册表中的卸载字符串以强制非静默卸载:

UPDATE, some additional alternatives (not always applicable, included for reference and potential re-use): 1) If you have access to the original MSI used to install your software (it must be the exact copy of the MSI used to install), then you can try to double click it and this should take you into modify directly. 2) You can also double click the file in the system cache folder if you no longer have the original installation MSI. 3) It might be you can hotfix the uninstall string in the registry as well to force a non-silent uninstall:

  • HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
  • HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall
  • HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall

可能还有其他方法.例如,4) 在卸载过程中修改一个转换应用,5) 修补已安装的 MSI(如果它到处都有大量安装),等等......

There are probably further ways. For example 4) hack a transform to apply during uninstall, 5) patch the installed MSI (if it is in the wild with lots of installs everywhere), etc...

这篇关于在完整的 ui 模式条件下卸载 msi(wix 工具集)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆