如何添加仅在卸载时发生的 WiX 自定义操作(通过 MSI)? [英] How to add a WiX custom action that happens only on uninstall (via MSI)?

查看:28
本文介绍了如何添加仅在卸载时发生的 WiX 自定义操作(通过 MSI)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想修改一个 MSI 安装程序(通过 WiX 创建)以删除整个目录卸载时.

I would like to modify an MSI installer (created through WiX) to delete an entire directory on uninstall.

我了解 WiX 中的 RemoveFileRemoveFolder 选项,但这些选项不够强大,无法递归删除包含安装后创建的内容的整个文件夹.

I understand the RemoveFile and RemoveFolder options in WiX, but these are not robust enough to recursively delete an entire folder that has content created after the installation.

我注意到类似的 Stack Overflow 问题卸载 WiX 时删除文件,但我想知道是否这可以通过调用批处理脚本来删除文件夹更简单地完成.

I noticed the similar Stack Overflow question Removing files when uninstalling WiX, but I was wondering if this could be done more simply using a call to a batch script to delete the folder.

这是我第一次使用 WiX,我仍然掌握 custom 的窍门行动.将在卸载时运行批处理脚本的自定义操作的基本示例是什么?

This is my first time using WiX, and I'm still getting the hang of custom actions. What would be a basic example of a custom action that will run a batch script on uninstall?

推荐答案

编辑:或许看看答案 当前正下方.

这个话题头疼了很久.我终于弄明白了.网上有一些解决方案,但没有一个真正有效.当然也没有文档.因此,在下面的图表中,有几个建议使用的属性以及它们在各种安装场景中的值:

This topic has been a headache for long time. I finally figured it out. There are some solutions online, but none of them really works. And of course there is no documentation. So in the chart below there are several properties that are suggested to use and the values they have for various installation scenarios:

因此,就我而言,我想要一个仅在卸载时运行的 CA,而不是升级、修复或修改.根据上表,我不得不使用

So in my case I wanted a CA that will run only on uninstalls - not upgrades, not repairs or modifies. According to the table above I had to use

<Custom Action='CA_ID' Before='other_CA_ID'>
        (NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")</Custom>

它成功了!

这篇关于如何添加仅在卸载时发生的 WiX 自定义操作(通过 MSI)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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