I have a requirement to permit a WiX installer to install the product only if Framework 4.6 is installed. If this is not the case I display an error message to the user.
This is working fine, but now I must verify that if there is a previous version running in framework 3.5, I must let the user know that Framework 4.6 is required. Somehow my approach is not working. Would appreciate a little help. This is the code I am using in WiX:
<PropertyRef Id="WIX_IS_NETFRAMEWORK_46_OR_LATER_INSTALLED" />
<Condition Message="This application requires .NET Framework 4.6. Please install the .NET Framework then run this installer again.">
<![CDATA[Installed OR WIX_IS_NETFRAMEWORK_46_OR_LATER_INSTALLED]]>
</Condition>
<PropertyRef Id="NETFRAMEWORK35" />
<Condition Message="This application requires .NET Framework 4.6. Please install the .NET Framework then run this installer again.">
<![CDATA[(NETFRAMEWORK35 AND NOT WIX_IS_NETFRAMEWORK_46_OR_LATER_INSTALLED)]]>
</Condition>
And in the CustomAction.config I have:
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" />
<supportedRuntime version="v2.0.50727"/>
</startup>
UPDATE
Changed the Launch Condition to:
<Condition Message="This application requires .NET Framework 4.6. Please install the .NET Framework then run this installer again.">
<![CDATA[(Installed OR (NETFRAMEWORK35 = "#1" AND WIX_IS_NETFRAMEWORK_46_OR_LATER_INSTALLED))]]>
</Condition>
But all the installer does is just display the familiar "Setup Wizard ended prematurely"
There may be something I don't understand about your scenario, but wouldn't the first condition cater for both cases? All you need is for .NET 4.6 to be installed? That second condition now appears to be true only when 3.5 is installed and 4.6 is not installed. So I assume the setup won't launch if both versions are installed - and I am not sure if those versions can co-exist? I can never keep track of what .NET versions can be installed at the same time, and what CLR they share. The 3.5 version came with Windows 7 I think? Some details.
I don't see any custom action WiX markup in your question, so I can't really say anything about that
CustomAction.config. Managed code custom actions are not my specialty.