Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I specify the minimum required .NET framework versions in WiX

Tags:

.net

wix

My application is compiled against the .NET 2.0 framework, but I want users to be able to install it on Windows 8 without being prompted to install .NET 3.5. To provide some background info, I have the following app.config file:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup>
        <supportedRuntime version="v4.0"/>
        <supportedRuntime version="v2.0.50727"/>
    </startup>
    <runtime>
      <NetFx40_LegacySecurityPolicy enabled="true"/>
    </runtime>
</configuration>

My question is, in the WiX .wxs file, do I need to specify every version of the framework that my app will run against, such as:

<PropertyRef Id="NETFRAMEWORK20"/>
<Condition Message="This application requires .NET Framework 2.0. Please install the .NET Framework then run this installer again.">
  <![CDATA[Installed OR NETFRAMEWORK20 OR NETFRAMEWORK30 OR NETFRAMEWORK35_CLIENT OR NETFRAMEWORK35 OR NETFRAMEWORK40CLIENT OR NETFRAMEWORK40FULL OR NETFRAMEWORK45]]>
</Condition>

Or, can I shortcut it and specify something like this:

<PropertyRef Id="NETFRAMEWORK20"/>
<Condition Message="This application requires .NET Framework 2.0. Please install the .NET Framework then run this installer again.">
  <![CDATA[Installed OR NETFRAMEWORK20 OR NETFRAMEWORK40CLIENT]]>
</Condition>
like image 426
CtrlDot Avatar asked Nov 11 '22 16:11

CtrlDot


1 Answers

when using bootstrapper what you can do is check the windows version and the .net version for example here:

<ExePackage Id="Netfx45Xxx" Cache="no" Compressed="no" PerMachine="yes" Permanent="yes" Vital="no" InstallCommand="/q"
SourceFile="..\SetupProject\dotnetfx45_full_x86_x64.exe"
DetectCondition="(Netfx4FullVersion=&quot;4.5.50709&quot;) AND (NOT VersionNT64 OR (Netfx4x64FullVersion=&quot;4.5.50709&quot;))" 
InstallCondition="(VersionNT &gt;= v6.0 OR VersionNT64 &gt;= v6.0) AND (NOT (Netfx4FullVersion=&quot;4.5.50709&quot; OR Netfx4x64FullVersion=&quot;4.5.50709&quot;))" />

So as you can see there is a Detect condition and install condition, which check the windows version and .Net version.

like image 199
Gilad Avatar answered Nov 15 '22 05:11

Gilad