如何检查WiX中的.NET framework 4.5预支持

时间:2013-04-30 14:40:31

标签: wix windows-installer .net-framework-version

我想验证在进行安装之前,应该在服务器上安装.NET framework 4.0和4.5。因此,我使用了以下代码段,但我不知道有关4.5的验证,但未在链接中列出Reference

<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>

1 个答案:

答案 0 :(得分:43)

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>