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

执行DISM命令的Wix自定义动作报错,求解决方案

解决Wix v4中DISM自定义动作执行报错问题

问题根源

报错1723和错误码1154的核心原因:

  • Wix v4中CAQuietExec的入口点名称已统一为CAQuietExec,不再区分CAQuietExec64/CAQuietExec32
  • 引用Wix Util自定义动作二进制的标识错误
  • 未在安装序列中执行前置的immediate自定义动作(用于传递命令行参数)

修改步骤及代码示例

1. 修正Install.wxs中的自定义动作定义

<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
     xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
    <?include "..\include\Variables.wxi" ?>
    <Fragment>
    <!-- 定义传递命令行的immediate自定义动作 -->
    <CustomAction Id="EnableShellLauncher"
                Property="ExecuteShellLauncherCommand"
                Value="&quot;[System64Folder]dism.exe&quot; /online /Enable-Feature /all /FeatureName:Client-EmbeddedShellLauncher"
                Execute="immediate"
                Return="check" />
    <!-- 修正DllEntry和BinaryRef -->
    <CustomAction Id="ExecuteShellLauncherCommand"
                    BinaryRef="WixUtilCA"
                    DllEntry="CAQuietExec"
                    Execute="deferred"
                    Return="check"
                    Impersonate="no" />
    </Fragment>
</Wix>

2. 修正Product.wxs中的安装序列

需要先执行EnableShellLauncher(immediate动作,用于给deferred动作传递命令参数),再执行ExecuteShellLauncherCommand,且确保两者都在InstallInitialize之后:

<InstallExecuteSequence>
    <Custom Action="EnableShellLauncher" After="InstallInitialize" />
    <Custom Action="ExecuteShellLauncherCommand" Before="InstallFinalize" />
</InstallExecuteSequence>

关键修改说明

  • DllEntry修正:Wix v4中CAQuietExec不再区分架构后缀,统一使用CAQuietExec作为入口点
  • BinaryRef修正:Wix v4的Util自定义动作二进制标识为WixUtilCA,无需加架构相关后缀
  • 序列补充:必须在deferred动作前执行immediate的参数传递动作,否则deferred动作无法获取到要执行的DISM命令

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.11 23:43:15