20

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

1
  • 3
    It is ironic that all the answers say search on Google. When this is the first hit on Google.
    – trampster
    Feb 24, 2011 at 20:53

2 Answers 2

37

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.

4
  • error LGHT0094: Unresolved reference to symbol 'Property:NETFRAMEWORK35' in section 'Product:*'.
    – mmr
    Mar 25, 2009 at 18:47
  • @mmr - I've clarified the answer, this is all I have to do to get it working. This will add reference to wixproj, which adds -ext WixNetFxExtension automatically to command line.
    – si618
    Mar 25, 2009 at 19:31
  • Anyone know if NETFRAMEWORK35 is true when only the .Net 4.0 framework is present?
    – KevM
    May 26, 2011 at 21:14
  • 1
    @KevM, I added another link, NETFRAMEWORK35 Set to #1 if the .NET Framework 3.5 is installed (not set otherwise). Of course you'll have to test this for yourself, but the documentation suggests no, it wouldn't be true.
    – si618
    May 27, 2011 at 1:58
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.