如何使用Wix 3.11检查.net框架4.7.1

hot*_*331 6 wix wix3

我试图通过条件检查.net版本与Wix 3.11.这样工作正常,直到4.5像这样:

<PropertyRef Id="NETFRAMEWORK45" />
  <Condition Message="This application requires .NET Framework 4.5. Please install the .NET Framework then run this installer again.">
    <![CDATA[Installed OR NETFRAMEWORK45]]>
  </Condition>
Run Code Online (Sandbox Code Playgroud)

检查4.5以上的任何东西似乎是不可能的 - 至少不是这种机制.我怎样才能做到这一点?

Chr*_*ter 10

那个方法(PropertyRef)是语法糖.NetFxExtension预处理器在编译时注入实现.WiX目前落后.您正在寻找的实现将是这样的:

<PropertyRef Id="NETFRAMEWORK45" />
<Condition Message="This application requires .NET Framework 4.7.1. Please install the .NET Framework then run this installer again."><![CDATA[Installed OR NETFRAMEWORK45>=#461308]]>
</Condition>
Run Code Online (Sandbox Code Playgroud)

https://github.com/wixtoolset/issues/issues/5575

更新(hot33331):在数字461308之前添加了#.没有它,它对我不起作用.

  • 我不得不把#461308放在双引号中,以便在VS 2017中编译.就像这样:<![CDATA [Installed OR NETFRAMEWORK45> ="#461308"]]> (4认同)