8

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 anything above 4.5 seems not to be possible - at least not with this mechanism. How can I do that?

hot33331
  • 805
  • 11
  • 25

1 Answers1

13

That method (PropertyRef) is syntactical sugar. The NetFxExtension preprocessor injects the implementation at compile time. WiX is currently lagging behind. The implementation you are looking for would be something like:

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

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

Update (hot33331): Added a # before the number 461308. Without that it did not work for me.

hot33331
  • 805
  • 11
  • 25
Christopher Painter
  • 54,556
  • 6
  • 63
  • 100
  • Thank you Christopher! I had to add a # in front of the number to compare, but after that it worked like a charm. Weird why they would put a # there... – hot33331 Apr 13 '18 at 13:10
  • Ahh, StackOverflow filtered out the # on me. All properties in MSI are string properties and you have to put a # in front of it to tell MSI to treat it as an integer. – Christopher Painter Apr 13 '18 at 13:19
  • See: https://msdn.microsoft.com/en-us/library/windows/desktop/aa371168(v=vs.85).aspx for different variants of #. – Christopher Painter Apr 13 '18 at 13:21
  • Also see: https://msdn.microsoft.com/en-us/library/windows/desktop/aa371171(v=vs.85).aspx Basically AppSearch/Reglocator reads the DWORD from the registry and puts the # on it since all properties are strings. – Christopher Painter Apr 13 '18 at 13:24
  • 5
    I had to put the #461308 in double quotes for this to compile in VS 2017. Like so: <![CDATA[Installed OR NETFRAMEWORK45 >= "#461308"]]> – Trevor Aug 24 '18 at 23:07