【问题标题】:WiX not detect VC++ redistributablesWiX 不检测 VC++ 可再发行组件
【发布时间】:2021-07-05 13:18:47
【问题描述】:

我正在按照Wix per user installer to detect the Visual C++ 2015 Redistributable 中的示例检测每个用户安装程序中的 VC+ 2015-2019 可再发行组件,但没有任何运气。我检查了 VC++ 2017-19 是否正确安装在我的系统上,如果我进行如下简单测试,它确实可以工作。

<Property Id="CPPRUNTIME2015X86">
    <RegistrySearch Id="mfc1429x86" Root="HKCR" Key="Installer\Dependencies\VC,redist.x86,x86,14.29,bundle" Type="raw" />
</Property>
<Condition Message="Microsoft Visual C++ 2015-2019 (x86) Redistributable missing">
    <![CDATA[Installed OR CPPRUNTIME2015X86]]>
</Condition>

但是,以下通用解决方案在我的系统上找不到可分发的内容。知道为什么吗?

    <Property Id="CPPRUNTIME2015X86" Secure="yes">
        <!-- C++ 2015 -->
        <RegistrySearch Id="mfc140x86_23026" Root="HKLM" Key="SOFTWARE\Classes\Installer\Dependencies\{74d0e5db-b326-4dae-a6b2-445b9de1836e}" Type="raw" />
        <RegistrySearch Id="mfc140x86_24215" Root="HKLM" Key="SOFTWARE\Classes\Installer\Dependencies\{e2803110-78b3-4664-a479-3611a381656a}" Type="raw" />

        <!-- C++ 2017 -->
        <RegistrySearch Id="mfc1416x86" Root="HKCR" Key="Installer\Dependencies\VC,redist.x86,x86,14.16,bundle" Type="raw" />

        <!-- C++ 2019 -->
        <?foreach CPPRUNTIMEVERSIONPREFIX in 21;22;23;24;25;26;27;28;29;30;31;32;33;34;35;36;37;38;39;40?>
            <RegistrySearch Id="mfc14$(var.CPPRUNTIMEVERSIONPREFIX)x86" Root="HKCR" Key="Installer\Dependencies\VC,redist.x86,x86,14.$(var.CPPRUNTIMEVERSIONPREFIX),bundle" Type="raw" />
        <?endforeach ?>
    </Property>
    <Condition Message="Microsoft Visual C++ 2015-2019 (x86) Redistributable missing">
        <![CDATA[((REMOVE="ALL")) OR Installed]]>
    </Condition>

【问题讨论】:

    标签: wix windows-installer vcredist


    【解决方案1】:

    在您的工作代码中搜索注册表项并将结果存储在 CPPRUNTIME2015X86 中。然后你的条件测试 CPPRUNTIME2015X86:

    <Condition Message="Microsoft Visual C++ 2015-2019 (x86) Redistributable missing">
    <![CDATA[Installed OR CPPRUNTIME2015X86]]>
    

    在您的非工作代码中搜索注册表项并将结果存储在 CPPRUNTIME2015X86 中。但是这次你的 Condition 没有测试 CPPRUNTIME2015X86:

       <Condition Message="Microsoft Visual C++ 2015-2019 (x86) Redistributable missing">
        <![CDATA[((REMOVE="ALL")) OR Installed]]>
    </Condition>
    

    这告诉我你检查注册表没问题,但你没有使用这些信息。

    如果您在工作代码中使用 Condition 测试,那么它是否有效?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-24
      • 2013-12-04
      • 1970-01-01
      • 2016-11-06
      • 1970-01-01
      相关资源
      最近更新 更多