如何在仅在安装或卸载时执行的WiX中执行自定义操作? [英] How can I perform a custom action in WiX that only executes on install or uninstall?
问题描述
我有两个自定义操作,其中一个我要在安装产品时执行,另一个要在卸载产品时执行。
I have two custom actions, one of which I'd like to execute when my product is installed and the other when it is uninstalled.
我的自定义操作是当前在 InstallFinalize之后从合并模块调用,但是安装和卸载都会发生这种情况。我尝试添加未安装且未升级PRODUCTCODE条件,但这给了我一个错误:
My custom action is currently called from a merge module after the "InstallFinalize", but this happens for both install and uninstall. I've tried adding the "NOT INSTALLED AND NOT UPGRADINGPRODUCTCODE" condition, but that gave me an error:
错误2762。无法编写脚本记录。事务未开始。
Error 2762. Cannot write script record. Transaction not started.
我也尝试附加到其他操作(例如,UnpublishComponents),但找不到任何操作
I've also tried attaching to other actions (for example, UnpublishComponents), but I can't find any that are unique to install or uninstall.
如何解决此问题?
推荐答案
尝试下一个
1。
仅用于安装:
Try next
1.
Only for Installation:
<InstallExecuteSequence>
<Custom Action="SomeAction" After="InstallFinalize">NOT Installed AND NOT REMOVE</Custom>
</InstallExecuteSequence>
2。
要卸载,请尝试使用: Rob的答案
2.
For Uninstall try to use: Rob's answer
UPGRADINGPRODUCTCODE 属性仅在期间设置RemoveExistingProducts
CA。
这篇关于如何在仅在安装或卸载时执行的WiX中执行自定义操作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!