如何在 WiX 中检查 .NET Framework 4.5 先决条件

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

我想在继续安装之前验证服务器上是否已安装 .NET Framework 4.0 和 4.5。因此我使用了以下代码片段,但我不知道 4.5 验证,该验证未在链接中列出参考

<PropertyRef Id="NETFRAMEWORK40FULL"/>
    <Condition Message='This setup requires Microsoft .NET Framework 4.0 Full package or greater needs to be installed for this installation to continue.'>
      <![CDATA[Installed OR NETFRAMEWORK40FULL]]>
    </Condition>
wix windows-installer .net-framework-version
1个回答
46
投票

NETFRAMEWORK45
属性的使用方式与
NETFRAMEWORK40FULL
相同。请注意,.NET Framework v4.5 没有“客户端”或“完整”框架。只有一个。 所以下面的代码应该做你想要的:

<PropertyRef Id="NETFRAMEWORK40FULL"/>
<PropertyRef Id="NETFRAMEWORK45"/>

<Condition Message='This setup requires Microsoft .NET Framework 4.0 Full package or greater needs to be installed for this installation to continue.'>
  <![CDATA[Installed OR NETFRAMEWORK40FULL]]>
</Condition>
<Condition Message='This setup requires Microsoft .NET Framework 4.5 package or greater needs to be installed for this installation to continue.'>
  <![CDATA[Installed OR NETFRAMEWORK45]]>
</Condition>

请注意,.NET Framework v4.5 是 .NET Framework 4.0 的就地升级,因此检查这两个条件可能会让您陷入永远无法满足这两个条件的情况。您可能只想检查是否安装了 .NET Framework v4.0 .NET Framework v4.5。这种情况看起来更像是:

<Condition Message='This setup requires Microsoft .NET Framework 4.0 Full or 4.5 package or greater needs to be installed for this installation to continue.'>
  <![CDATA[Installed OR NETFRAMEWORK40FULL OR NETFRAMEWORK45]]>
</Condition>
© www.soinside.com 2019 - 2024. All rights reserved.