我有以下自定义操作,通常从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 & MyService.exe -install & exit"' Return="check" Impersonate="no" />