WiX 中与平台无关的 .NET 兼容性检查

问题描述 投票:0回答:1

我正在使用 WiX 为 32 位和 64 位系统构建 MSI 安装程序。该软件包有一些先决条件,需要在安装之前检查,以便用户更容易知道出了什么问题。

我对 x64 进行了以下兼容性检查,但此检查实际上会使 32 位系统上的安装程序崩溃。

        <netfx:DotNetCompatibilityCheck Id="netCoreStatus"
            Property="NETCORESTATUS" RollForward="latestMajor"
            RuntimeType="desktop" Version="6.0.0" Platform="x64" />
        <Launch Condition="Installed OR NETCORESTATUS=&quot;0&quot;"
            Message="[ProductName] requires Microsoft .NET 6.0 Desktop Runtime - 6.0.0 or greater." />

我还使用

DotNetCoreSearch
尝试了以下操作,但幸运的是,虽然这不会使安装程序崩溃,但它会忽略
VersionNT64
条件并无论机器架构如何都运行。

        <netfx:DotNetCoreSearch
            RuntimeType="desktop"
            Condition="NOT VersionNT64"
            Platform="x64"
            MajorVersion="6"
            Variable="NetCoreRuntimeVersion"
        />
        <Launch Condition="VersionNT64 AND (Installed OR NetCoreRuntimeVersion=&quot;0&quot;)"
            Message="[ProductName] requires Microsoft .NET 6.0 Desktop Runtime - 6.0.0 or greater." />

如何使用 WiX 执行与平台无关的 .net 检查?据我所知

Platform
属性仅接受 x86 或 x64。

wix windows-installer
1个回答
0
投票

我对此进行了一些思考。这可能是 WiX 的一个错误。它可能不应该尝试在 x86 计算机上进行 x64 搜索,而只是将该属性留空。这可能是他们没有考虑到的极端情况。在未来版本中修复此问题之前,我认为唯一的解决方法是编写 x86 搜索而不是 x64 搜索。如果 VersionNT64 为 true,请改为使用自定义操作在安装时将临时记录插入到 Wix4NetFxDotNetCheck 表中。

© www.soinside.com 2019 - 2024. All rights reserved.