How to check for .net 5 with Wix (version 3.11)

Viewed 2310

I am trying to check for .net Version with Wix 3.11 via Condition. This works fine until 4.5 like this:

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

Checking for .Net 5 seems not to be possible - at least not with this mechanism. How can I do that?

1 Answers

The NETFAMEWORK45 property is injected at build time by the NetFx extension. It does not currently have support for .NET 5. You can see the source code for how it works here:

https://github.com/wixtoolset/Netfx.wixext/tree/master/src/wixlib

A custom action shouldn't be needed to detect .NET Core. Simply write a Property / RegSearch similar to the one below but modified for the details of the footprint .NET 5 leaves behind.

  <Fragment>
    <Property Id="NETFRAMEWORK40CLIENT" Secure="yes">
      <RegistrySearch Id="NetFramework40Client" Root="HKLM" Key="SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Client" Name="Install" Type="raw" />
    </Property>
  </Fragment>
Related