windows-installer - 有条件地安装基于安装目录的组件,WiX 安装程序
问题描述
我正在使用 WiX 工具集创建安装程序。
我正在使用 WixUI_InstallDir UI,因为我需要选择文件的安装位置。
我的要求是用户选择安装在 Program Files 中,一些文件(配置)应该放在 ProgramData 文件夹中,否则,它将位于安装目录本身中,
这就是我到目前为止所得到的。
<!--Add Components in [ProgramData]/Configs-->
<DirectoryRef Id="CommonConfigsFolder">
<Component Id="ServiceConfigAppData" Guid="{1053F925-BEB3-4020-90C5-6EF163326B5E}">
<Condition>
<![CDATA[WIXUI_INSTALLDIR >< "Program Files"]]>
</Condition>
<CreateFolder>
<Permission User="Everyone" FileAllRights="yes"/>
</CreateFolder>
<File Id="ServicesConfigFileAppData" KeyPath="yes" Source="$(var.ConfigPath)\Services.cfg"/>
</Component>
</DirectoryRef>
<!--Add Components in [INSTALLFOLDER]/Configs-->
<DirectoryRef Id="LocalConfigFolder">
<Component Id="ServiceConfigLocal" Guid="{B4E52504-C4BF-4C99-88C4-5AF54D49E78A}">
<Condition>
<![CDATA[NOT (WIXUI_INSTALLDIR >< "Program Files")]]>
</Condition>
<CreateFolder>
<Permission User="Everyone" FileAllRights="yes"/>
</CreateFolder>
<File Id="ServicesConfigFileLocal" KeyPath="yes" Source="$(var.ConfigPath)\Services.cfg"/>
</Component>
</DirectoryRef>
但它总是将文件写入安装目录,即使我安装在程序文件中
我必须定义
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER"/>
才能使 WixUI_InstallDir 工作
解决方案
推荐阅读
- hdfs - hdfs 快照是否适用于附加数据?
- visual-studio - 一个 VSTS 项目可以映射到不同的本地工作空间吗?
- excel - 使用 VBA Find 函数检查 Excel 工作表上是否已存在范围
- javascript - 在 Angular 2 中获取 GPS 源信息
- python - 从 setup.py 中查找 boost_python 版本
- selenium - 如何在机器人框架 RIDE 上运行录制的自动化脚本
- ms-access - 错误:SharePoint/Access 链接列表中的“找不到字段”
- django - 登录后根据用户组重定向
- tensorflow - Nvidia Digits 批量大小和数据混洗如何工作?
- powershell - 使用 OpenSLL 错误对文件夹和/或内容进行签名