【发布时间】:2015-09-01 10:35:06
【问题描述】:
我正在尝试使用 WiX 安装程序在 cmd 中运行自定义命令。
我使用 Product.wxs 中的包含文件,该文件在整个安装过程中被正确使用。
我有 3 个自定义操作,其中 2 个工作正常。似乎不起作用的一个是:
<CustomAction Id='AddDefaultDomain'
Directory='TARGETDIR'
Impersonate="no"
Execute="immediate"
ExeCommand="C:\windows\system32\inetsrv\appcmd.exe set config /section:basicAuthentication /defaultLogonDomain:[%USERDOMAIN] /commit:apphost"
Return="asyncNoWait" />
安装程序运行正常,当我通过 cmd 窗口调用 AppCmd 并复制->在 cmd 中粘贴“ExeCommand”并执行它时,它工作正常。
可能这很简单,但现在我不明白为什么它不起作用。
感谢所有帮助。
完整包含文件
<?xml version="1.0" encoding="utf-8"?>
<Include>
<!-- Create Scheduled Task -->
<InstallExecuteSequence>
<Custom Action="CreateScheduledTaskGoogleService" After="InstallFiles">NOT Installed</Custom>
<Custom Action="CreateScheduledTaskGoogleServiceId" After="CostFinalize">NOT Installed</Custom>
<!-- Add Defualt DOmain -->
<Custom Action="AddDefaultDomain" After="CostFinalize">NOT Installed</Custom>
</InstallExecuteSequence>
<CustomAction Id="CreateScheduledTaskGoogleService" Return="check" Impersonate="no" Execute="deferred" BinaryKey="WixCA" DllEntry="CAQuietExec" />
<CustomAction Id="CreateScheduledTaskGoogleServiceId" Property="CreateScheduledTaskGoogleService" Execute="immediate" Value=""[SystemFolder]SCHTASKS.EXE" /CREATE /TN "ActaNet Control - Google Sync" /XML "[INSTALLFOLDERPROGRAMFILESGOOGLE]ScheduledTask.xml"" />
<!-- DOES NOT SEEM TO BE WORKING! -->
<CustomAction Id='AddDefaultDomain'
Directory='TARGETDIR'
Impersonate="no"
Execute="immediate"
ExeCommand="C:\windows\system32\inetsrv\appcmd.exe set config /section:basicAuthentication /defaultLogonDomain:[%USERDOMAIN] /commit:apphost"
Return="asyncNoWait" />
<!-- Delete Scheduled Task -->
<InstallExecuteSequence>
<Custom Action="TaskDeleteGoogleService" Before="CreateScheduledTaskGoogleService">REMOVE="ALL"</Custom>
</InstallExecuteSequence>
<CustomAction Id="TaskDeleteGoogleService" Return="ignore" Execute="deferred" Directory="TARGETDIR" Impersonate="no" ExeCommand="SCHTASKS.EXE /DELETE /TN "ActaNet Control - Google Sync" /F" />
</Include>
【问题讨论】: