wix - 如何使用 Wix msi 选择性地安装 MSI
问题描述
如何使用 Wix 检查注册表设置,并根据该值从 2 个 MSI 中选择正确的 MSI 进行安装?注册表项表示 x86 或 x64。如果是 x64,则 Wix 安装程序应安装 64 位 Msi。如果是 x86,则应安装 32 位版本。
我试过这个,但我只是在安装时收到一个错误,上面写着
“无法打开此安装包。请联系供应商以验证这是一个有效的 Windows Installer 包。”
两个“链接”的 MSI 都可以正常运行。
这是一个 Bundle.wxs 文件,是 Wix 项目中的唯一文件。
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Bundle Name="SingleInstaller" Version="1.0.0.0" Manufacturer="Microsoft" UpgradeCode="935daa4e-9b25-4fef-a4a1-0cf6af71a939">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense"/>
<!--Search the registry entries for each because it may be under Wow6432-->
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\SomeEntry\" Value="Bitness" Variable="MyRegEntry" Win64="no" />
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\SomeEntry\" Value="Bitness" Variable="MyRegEntry" Win64="yes" />
<Chain>
<!-- TODO: Define the list of chained packages. -->
<!--<MsiPackage SourceFile="D:\Dev\Cwds_Install\bin\x86\Release\JMPS-CC-CWDS3.0.0.0.msi" InstallCondition="Jmps32Bit = x86" Id="Cwds32"/>-->
<MsiPackage SourceFile="D:MyProgram.msi" InstallCondition="MyRegEntry = x86" Id="MyProgram32" />
<MsiPackage SourceFile="D:MyProgram.msi" InstallCondition="MyRegEntry = x64" Id="MyProgram64" />
</Chain>
</Bundle>
</Wix>
解决方案
推荐阅读
- c++ - c ++地图缓存找不到条目
- php - Typo3 登录屏幕后无法访问后端
- python - 具有正弦波纹的 n 阶多项式的曲线拟合
- django - Django Form 无效但没有给我错误
- datagrid - 如何有条件地显示 oroinc 前端数据网格?
- c# - 并行 Ping 多个 IP 地址 - C#
- indexeddb - 由于版本需要升级时如何使用 localforage.js 清除 indexedDB
- nginx - Nginx 反向代理根 URI 问题
- c++ - 直接在 Rcpp 中使用 (c)igraph(即,不经过 R)
- c++ - 如何在 VisualStudio 中对 main() 进行单元测试