I am trying to create a WiX package that installs the .NET Framework 4.0 before installing MSI . I checked the log file for my bootloader using the \l log.txt command line argument and found that ExePackage::DetectCondition always evaluates to false.
I include WixNetFxExtension.dll as a reference in a Visual Studio 2010 Windows Installer XML Bootstrapper project.
I include the NetFxExtension namespace:
<?xml version="1.0" encoding="UTF-8"?> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension" xmlns:bal="http://schemas.microsoft.com/wix/BalExtension" xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
Providing a basic package structure:
<Bundle Name="RSA Bootstrapper" ... <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" /> ... <Chain> <PackageGroupRef Id="NET40" /> <PackageGroupRef Id="RSA_Application" /> </Chain> </Bundle> ...
I include <PropertyRef Id="NETFRAMEWORK40FULL" /> in the fragment, and then to define ExePackage for the .NET Framework 4.0 ( NET40 ):
<Fragment> <PropertyRef Id="NETFRAMEWORK40FULL" /> <PackageGroup Id="NET40"> <ExePackage SourceFile="dotNetFx40_Full_x86_x64.exe" Compressed="yes" Cache="yes" DetectCondition="NETFRAMEWORK40FULL" InstallCommand="/norestart /passive /showrmui /ACTION=Install" Permanent="yes" InstallCondition="NOT NETFRAMEWORK40FULL" Vital="yes" > <ExitCode Value="0" Behavior="success" /> <ExitCode Value="1641" Behavior="scheduleReboot" /> <ExitCode Value="3010" Behavior="scheduleReboot" /> <ExitCode Behavior="error" /> </ExePackage> ...
I also checked the output of the Visual Studio assembly to confirm that the WixNetFxExtension.dll link was WixNetFxExtension.dll :
C: \ Program Files (x86) \ WiX Toolset v3.7 \ bin \ Light.exe ... -ext "C: \ Program Files (x86) \ WiX Toolset v3.7 \ bin \ WixNetFxExtension.dll"
The problem is the DetectCondition property. No matter what I installed, it evaluates to false .
Thinking that maybe the NETFRAMEWORK40FULL link cannot be trusted, I tried to use this instead:
<Fragment> <Variable Name="isInstalled" Type="numeric" Value="0" Persisted="yes" bal:Overridable="yes"/> <util:RegistrySearch Id="FindInstallKey" Root="HKLM" Key="SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" Value="Install" Result="exists" Variable="InstallKeyExists" /> <util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" Value="Install" Variable="isInstalled" After="FindInstallKey" Condition="InstallKeyExists = true" Format="raw" /> </Fragment>
Setting DetectCondition="isInstalled" or DetectCondition="isInstalled = true" always evaluated as false. Even setting DetectCondition="true" always evaluated as false!
Here is a snippet of the log I'm talking about with DetectCondition="true"
[16A0:17B4][2013-02-13T13:01:43]i001: Burn v3.7.1224.0, Windows v6.1 (Build 7601: Service Pack 1), path: C:\Users\lalic\Documents\Visual Studio 2010\Projects\RSA Preset\Bootstrapper\bin\Release\Bootstrapper.exe, cmdline: '/l log.txt -burn.unelevated BurnPipe.{33090847-CC78-445B-BAAA-564B840B7E8E} {38F95C6A-EC0F-4402-951B-FABFC5827CB6} 6296' [16A0:17B4][2013-02-13T13:01:43]i000: Setting string variable 'WixBundleLog' to value 'C:\Users\lalic\Documents\Visual Studio 2010\Projects\RSA Preset\Bootstrapper\bin\Release\log.txt' [16A0:17B4][2013-02-13T13:01:43]i000: Setting string variable 'WixBundleOriginalSource' to value 'C:\Users\lalic\Documents\Visual Studio 2010\Projects\RSA Preset\Bootstrapper\bin\Release\Bootstrapper.exe' [16A0:17B4][2013-02-13T13:01:43]i052: Condition '((VersionNT = v5.1) AND (ServicePackLevel >= 3)) OR ((VersionNT = v5.2) AND (ServicePackLevel >= 2)) OR ((VersionNT = v6.0) AND (ServicePackLevel >= 1)) OR (VersionNT >= v6.1)' evaluates to true. [16A0:17B4][2013-02-13T13:01:43]i000: Setting string variable 'WixBundleName' to value 'RSA Bootstrapper' [16A0:17B4][2013-02-13T13:01:43]i100: Detect begin, 2 packages [16A0:17B4][2013-02-13T13:01:43]i052: Condition 'true' evaluates to false. [16A0:17B4][2013-02-13T13:01:43]i103: Detected related package: {D431417D-F0AC-4CFB-8E25-E27F5B8101D9}, scope: PerMachine, version: 2.1.15.0, language: 0 operation: MajorUpgrade [16A0:17B4][2013-02-13T13:01:43]i101: Detected package: dotNetFx40_Full_x86_x64.exe, state: Absent, cached: None [16A0:17B4][2013-02-13T13:01:43]i101: Detected package: RSA_Preset.msi, state: Absent, cached: None [16A0:17B4][2013-02-13T13:01:43]i199: Detect complete, result: 0x0 [16A0:17B4][2013-02-13T13:02:04]i200: Plan begin, 2 packages, action: Install [16A0:17B4][2013-02-13T13:02:04]i052: Condition 'NOT NETFRAMEWORK40FULL' evaluates to true.
In particular, i052: Condition 'true' evaluates to false. and actually Condition 'NOT NETFRAMEWORK40FULL' evaluates to true. although I have installed .NET 4.0 Full and you can manually find the .NET 4.0 entry in my registry, either in the usual place or under HKLM\SOFTWARE\Wow6432Node (I'm on a 64-bit system).
Am I missing something? Why is DetectCondition not working for me? The project compiles, runs, deploys the payload (s) and otherwise works fine.