1
votes

I use WIX 3.8 for my application and it needs .NET Framework 3.5 SP1 to be installed as prerequisite in the machine.

I do a check for the .net Framework inside the bundle.wxs and when executed, I face the below problems.
1. The bootstrapper always tries to install the .net framework even though the supported runtime versions defined in the config file is v3.5.
2. On accepting and continuing the installation, the boostrapper fails to load and the setup abrupts.

From the log file, I see that the condition on the Detect condition is successful when tested in a machine with .net 3.5 SP1 already installed. But it exits with the message : "The prerequisites were already installed. The bootstrapper application will not be reloaded to prevent an infinite loop."

Can anyone let me know why is the BootStrapper always trigger the .net framework even though already installed in the machine?

Attaching the code snippet of the .net check as well as the config file changes:

<PackageGroup Id="Netfx35Full" >
<ExePackage Id="Netfx35Full" DisplayName="Microsoft .NET Framework 3.5"                Cache="no" Compressed="yes" PerMachine="yes" Permanent="yes" Vital="no"                     SourceFile='..\prereq\dotnetfx35setup.exe' InstallCommand='/q /norestart'
RepairCommand="/q /norestart" UninstallCommand="/q /norestart"                    InstallCondition="(NOT Netfx35FullVersion AND Netfx35FullVersion &lt; v3.5.30729.1) 
AND (NOT Netfx35x64FullVersion AND Netfx35x64FullVersion &lt; v3.5.30729.1) AND NOT   Netfx4FullVersion OR NOT Netfx4x64FullVersion " DetectCondition="(Netfx35FullVersion AND   Netfx35FullVersion &gt;= v3.5.30729.1) OR (Netfx35x64FullVersion AND Netfx35x64FullVersion   &gt;=  v3.5.30729.1) OR Netfx4FullVersion OR Netfx4x64FullVersion"/>
</PackageGroup>

Config file

 <startup useLegacyV2RuntimeActivationPolicy="true">
 <supportedRuntime version="v3.5" />
 </startup>
 <wix.bootstrapper>
 <host assemblyName="SCM.BootstrapperApplication">
 <supportedFramework version="v3.5" />
 </host>
 </wix.bootstrapper>
2

2 Answers

1
votes

How are you using the properties "Netfx35FullVersion"/"Netfx35x64FullVersion" etc? have you defined them yourself?

You can make use of the WixNetfxExtension properties as defined in this page: WIXNETFXEXTENSION

For example, to check whether 3.5 framework or 3.5 SP is installed you can make use of the below properties.

NETFRAMEWORK35 - Set to #1 if the .NET Framework 3.5 is installed (not set otherwise).
NETFRAMEWORK35_SP_LEVEL - Indicates the service pack level for the .NET Framework 3.5.

To make use of these properties in your project, follow the below steps: Source: How to check .Net framework versions

Step 1. Add the WiX .NET extensions library to your project If you are using WiX in Visual Studio you can add the extensions using the Add Reference dialog:

  1. Open your WiX project in Visual Studio
    1. Right click on your project in Solution Explorer and select Add Reference...
    2. Select the WixNetFxExtension.dll assembly from the list and click Add
    3. Close the Add Reference dialog

Step 2: Add the WiX .NET extensions namespace to your project

Once the library is added to your project you need to add the .NET extensions namespace to your project so you can access the appropriate WiX elements. To do this modify the top-level element in your project by adding the following attribute:

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">

Step 3: Reference the required properties in your project

<PropertyRef Id="NETFRAMEWORK20"/>

Step 4: Use the pre-defined properties in a condition

To check against the service pack level of the framework use the *_SP_LEVEL properties. The following condition blocks installation if .NET Framework 3.0 SP1 is not present on the machine.

<Condition Message="This application requires .NET Framework 3.0 SP1. Please install the .NET Framework then run this installer again.">
    <![CDATA[Installed OR (NETFRAMEWORK30_SP_LEVEL and NOT NETFRAMEWORK30_SP_LEVEL = "#0")]]>
</Condition>
0
votes

Sometimes you get this message in the log when you have a prereq .net package you want to install and in your BootstrapperCore configuration file you have supplied the statup attribute which evaluates to false. I would suggest you may want to revisit the BootstrapperCore configuration file to address this.