Cre*_*ing 12 service conditional wix file
在Windows中安装XML工具集,安装服务,我们组<ServiceInstall>有<File>一个<Component>.为了有条件地安装服务,我们提出<Condition>了<Component>.但是,如果条件为false,则也不会安装该文件.如果我把它<File>放在一个无条件的<Component>,那么该服务没有可执行文件路径,因此安装将失败.如果我放入<File>两者<Component>,将找到重复的符号.
问题是,我们可以有条件地安装服务,但无条件安装相关的可执行文件吗?
谢谢!
使用不同的GUID和Ids以及互斥条件创建两个组件:一个用于文件和服务,另一个用于文件.像这样的东西:
<Component Id="SvcComp" Guid="{YOUR-GUID}" SharedDllRefCount="yes">
<Condition> SOME_CONDITION </Condition>
<File Id="SvcFile" Name="Service.exe" Source="Service.exe" Vital="yes" />
<ServiceInstall Id="Svc" Name="Service" DisplayName="Service" Description="Service" Type="ownProcess" Start="auto" ErrorControl="normal" Vital="yes" />
<ServiceControl Id="Svc" Name="Service" Stop="both" Remove="uninstall" Wait="yes" />
</Component>
<Component Id="ExeComp" Guid="{YYOUR-GUID}" SharedDllRefCount="yes" >
<Condition> NOT SOME_CONDITION </Condition>
<File Id="ExeFile" Name="Service.exe" Source="Service.exe" Vital="yes" />
</Component>
Run Code Online (Sandbox Code Playgroud)
您将收到LGHT1076警告,由于组件中的条件是互斥的,因此可以将其禁止.