How can I detect .NET 3.5 in WiX?

2019-01-18 09:39发布

I'm trying to detect which version .NET is installed using WiX. I've tried:

<Condition Message='This setup requires the .NET Framework 3.5 or higher.'>
  <![CDATA[MsiNetAssemblySupport >= "3.5.0.0"]]>
</Condition>

But that won't work, because the MsiNetAssemblySupport property checks the version of fusion.dll, which wasn't updated from version 2.0 in .NET 3.0 or 3.5.

Is it feasible to check for the presence of the .NET libraries in the system directory? How would I do that using WiX? Or is there some way to do that using the registry?

(I realize that there's a WiX user email list, but this is the Oughts-- I don't like 1980s technology, I like stuff I can easily search.)

标签: .net wix version
2条回答
疯言疯语
2楼-- · 2019-01-18 10:12

The answer seems to be no. You cannot (in a reliable way) check whether .NET framework version X or higher is installed. You can only check whether a specific .NET version is installed. Now that .NET 4.0 is released it is annoying that you have to install .NET 3.5 even if .NET 4.0 is already installed.

I hope the WiX developers will find a solution to this problem.

查看更多
Rolldiameter
3楼-- · 2019-01-18 10:15

Visual Studio -> WiX project -> Add Reference -> WixNetFxExtension.dll and then:

<PropertyRef Id="NETFRAMEWORK35" />
<Condition Message="This setup requires the .NET Framework 3.5 to be installed.">
  Installed OR NETFRAMEWORK35
</Condition>

Full details, including all .NET version properties available in the extension. Also consider whether condition message should be localized.

查看更多
登录 后发表回答