Wix 使用自定义操作执行命令不起作用

Wix Executing command using custom action not working

我有以下自定义操作,通常会从 windows 服务中删除 exe 并将其添加回来,

<CustomAction Id="ExecRemoveService" Directory="INSTALLDIR" Execute="immediate" ExeCommand="MyExe.exe -remove" Return="ignore" />
    <CustomAction Id="ExecInstallService" Directory="INSTALLDIR" Execute="immediate" ExeCommand="MyExe.exe -install" Return="ignore" />
    <InstallExecuteSequence>
      <Custom Action="ExecRemoveService" After="InstallFinalize" />
      <Custom Action="ExecInstallService" After="InstallFinalize" />
    </InstallExecuteSequence>

当 运行 MSI 没有任何反应时,它成功完成但我看到的 windows 服务内部什么也没有。

这个对我有用,

    <CustomAction 
Id="ExecInstallService" 
Directory="INSTALLDIR" 
Execute="deferred" 
ExeCommand='cmd.exe /k "MyService.exe -remove &amp; MyService.exe -install &amp; exit"' Return="check" Impersonate="no" />