You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Wix 5疑问:为何安装、卸载自定义操作均在两种流程中触发?

问题原因及解决方案

你当前的配置里,两个CustomAction之所以会在安装和卸载流程中都被调用,核心原因是没有给它们添加执行条件。

在Wix的InstallExecuteSequence中,如果不给<Custom>元素指定Condition属性,这个CustomAction会默认在所有执行场景(包括安装、卸载、修复、版本升级等)中被触发,这就导致你看到的两个操作在安装和卸载时都跑了一遍。

修正方法

给两个CustomAction分别添加对应的执行条件,限定它们只在目标场景下运行:

  • 给InstallConfigFile添加条件NOT Installed:表示仅在首次安装时执行
  • 给UnInstallConfigFile添加条件REMOVE="ALL":表示仅在完全卸载时执行

修改后的配置示例

<CustomAction Id="InstallConfigFile" BinaryRef="dllExecutionTest"
              DllEntry="InstallConfigFile"            
              Return="check"  />
<CustomAction Id="UnInstallConfigFile" BinaryRef="dllExecutionTest"
              DllEntry="UnInstallConfigFile"          
              Return="check"  />
<InstallExecuteSequence>
  <Custom Action="InstallConfigFile" After="InstallFiles">NOT Installed</Custom>
  <Custom Action="UnInstallConfigFile" After="RemoveFiles">REMOVE="ALL"</Custom>
</InstallExecuteSequence>

内容的提问来源于stack exchange,提问作者Bruno C

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.17 18:43:16