How to check for .net framework 4.7.1 with Wix 3.11
Asked Answered
J

1

9

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?

Jordaens answered 11/4, 2018 at 15:5 Comment(0)
G
14

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.

Gaven answered 11/4, 2018 at 15:15 Comment(5)
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...Jordaens
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.Gaven
See: msdn.microsoft.com/en-us/library/windows/desktop/… for different variants of #.Gaven
Also see: msdn.microsoft.com/en-us/library/windows/desktop/… Basically AppSearch/Reglocator reads the DWORD from the registry and puts the # on it since all properties are strings.Gaven
I had to put the #461308 in double quotes for this to compile in VS 2017. Like so: <![CDATA[Installed OR NETFRAMEWORK45 >= "#461308"]]>Bunkhouse

© 2022 - 2024 — McMap. All rights reserved.