首页 > 解决方案 > 如何使用 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>

标签: wixinstallationchained

解决方案


推荐阅读