Aja*_*jay 4 windows-installer wix
我有一个 WiX 脚本,可以安装服务。我ServiceInstall
在Component
.
<ServiceInstall Id="ServiceInstaller" Type="ownProcess" Vital="yes"
Name="abc" DisplayName="abc service"
Description="It does this" Start="auto"
Account="LocalSystem" ErrorControl="normal" Interactive="no">
<ServiceConfig DelayedAutoStart="yes" OnInstall="yes" OnReinstall ="yes" />
</ServiceInstall>
Run Code Online (Sandbox Code Playgroud)
从代码中可以看出,我使用ServiceConfig
withDelayedAutoStart
标志将服务设置为以延迟自动启动模式启动。但是 WiX 编译器 ( candle.exe
) 会触发警告:
警告 CNDL1150:Windows 安装程序 SDK 中记录的 ServiceConfig 功能“未按预期 [工作]”。考虑用 WixUtilExtension ServiceConfig 元素替换 ServiceConfig。
因此,我尝试使用util:ServiceConfig
^,但是此元素没有任何属性来控制服务启动。
^命名空间导入:
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
Run Code Online (Sandbox Code Playgroud)
因此,问题很简单:
检查来源后,目前似乎不可能。维克斯调用ChangeServiceConfig2功能只与SERVICE_CONFIG_FAILURE_ACTIONS
参数,而不是用SERVICE_CONFIG_DELAYED_AUTO_START_INFO
。
如果我是你,我会sc config abc start=delayed-auto
在 CMD 中编写一个自定义操作调用。
至于你的第二个问题,添加VersionNT版本条件(VersionNT >= 600
适用于所有大于Vista的版本)