Bev*_*van 44 windows-installer wix wix-extension msiexec
TL; DR:为什么我需要在这个条件组件中使用空 <CreateFolder/>
元素才能使其工作?
我正在为一个内部应用程序组装一个简单的基于WiX的安装程序.此安装程序需要部署标准配置文件(普通.NET .config
文件),然后使用msiexec
在命令行上传递的属性对其进行自定义.
其中一个自定义是仅在已定义RUNTIME属性时才创建特定的应用程序设置.这是WiX组件:
<Component Id="C.Rbnz.Fsis.CollectionPeriodService.exe.config.runtime"
Guid="*">
<Condition>
<![CDATA[RUNTIME]]>
</Condition>
<CreateFolder/>
<util:XmlFile Id="X.Runtime.1"
Action="createElement"
ElementPath="/configuration/appSettings"
File="[#F.Rbnz.Fsis.CollectionPeriodService.exe.config]"
Name="add"
Sequence="2"/>
<util:XmlFile Id="X.Runtime.2"
File="[#F.Rbnz.Fsis.CollectionPeriodService.exe.config]"
ElementPath="/configuration/appSettings/add[\[]not(@key)[\]]"
Action="setValue"
Name="key"
Value="RunTime"
Sequence="3"/>
<util:XmlFile Id="X.Runtime.3"
File="[#F.Rbnz.Fsis.CollectionPeriodService.exe.config]"
ElementPath="/configuration/appSettings/add[\[]@key='RunTime'[\]]"
Action="setValue"
Name="value"
Value="[RUNTIME]"
Sequence="4"/>
</Component>
Run Code Online (Sandbox Code Playgroud)
这正如我想要的那样 - 如果在命令行上指定了RUNTIME,则会msiexec
创建新元素; 如果没有,没有任何反应.
为什么我必须<CreateFolder/>
在此组件中使用空?
当我试图让这个工作时,我找到了" Wix条件声明 ",它显示了一个工作组件,但没有解释为什么<CreateFolder/>
是必要的.
删除<CreateFolder/>
给我这个错误:
ICE18:组件的KeyPath:'C.Rbnz.Fsis.CollectionPeriodService.exe.config.runtime'是目录:'INSTALLDIR'.目录/组件对必须在CreateFolders表中列出.
一旦你知道这意味着什么,我相信,这是非常有用的.
Bob*_*son 44
每个组件都有一个关键路径; 最常见的是文件.您的组件没有文件或其他密钥路径,因此WiX为其提供了默认的目录.然后Windows Installer出现并说具有目录密钥路径的组件必须确保创建目录,即使其他内容也会这样做.这是一个愚蠢的规则,易于修复.
归档时间: |
|
查看次数: |
15346 次 |
最近记录: |