WiX 'Bundle' 'ExePackage' 'DetectCondition' is always false
Solution 1
<PropertyRef Id="NETFRAMEWORK40FULL" />
is a reference to an MSI property but you're creating a bundle. Bundles have variables that are distinct from MSI properties, though Burn itself provides a number of bundle variables that mimic those that MSI provides.
That said, WixNetFxExtension provides package groups for the 4.0 NetFx installers. You can replace all that with a simple <PackageGroupRef Id="NetFx40Redist" />
.
Solution 2
Variables like NETFRAMEWORK40FULL are MSI variables, you cannot use them in Bundles.
I have successfully embedded the .NET Framework 4.0 Client Version within my bundle. Conditions variables resolved from the Registry.
Notice the syntax "<<"
(which translates to <<) in DetectCondition attribute. This page may help http://wix.tramontana.co.hu/tutorial/com-expression-syntax-miscellanea/expression-syntax
<?xml version="1.0" encoding="UTF-8"?>
<Wix
xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
<Bundle
Name="My Program Name"
Version="1.2.0"
Manufacturer="SUSU"
UpgradeCode="some-guid">
<Chain>
<PackageGroupRef Id="Netfx4"/>
<MsiPackage Id="MyProgramInstaller" SourceFile="product.msi" Compressed="yes"/>
</Chain>
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
<bal:WixStandardBootstrapperApplication
LicenseFile="license.rtf"
ShowVersion="yes"
/>
</BootstrapperApplicationRef>
</Bundle>
<Fragment>
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Client" Value="Version"
Variable="Netfx4ClientVersion" />
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Client" Value="Version"
Variable="Netfx4x64ClientVersion" Win64="yes" />
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full" Value="Version"
Variable="Netfx4FullVersion" />
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full" Value="Version"
Variable="Netfx4x64FullVersion" Win64="yes"/>
<PackageGroup Id="Netfx4">
<ExePackage
Id="Netfx4"
Cache="no"
Compressed="yes"
PerMachine="yes"
Permanent="yes"
Vital="yes"
SourceFile="c:\Downloads\dotNetFx40_Client_x86_x64.exe"
InstallCommand="/q"
DetectCondition="(Netfx4FullVersion << "4") OR (Netfx4ClientVersion << "4") OR (Netfx4x64ClientVersion << "4") OR (Netfx4x64FullVersion << "4")"
/>
</PackageGroup>
</Fragment>
</Wix>
Terrabits
Updated on June 04, 2022Comments
-
Terrabits almost 2 years
I am trying to create a WiX bundle that installs the .NET Framework 4.0 before my MSI installer. I inspected the log file for my bootstrapper using the command line argument
\l log.txt
and discovered that theExePackage::DetectCondition
is always evaluating to false.I am including
WixNetFxExtension.dll
as a reference in my Visual Studio 2010 Windows Installer XML Bootstrapper project.I am including 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 the basic bundle framework:
<Bundle Name="RSA Bootstrapper" ... <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" /> ... <Chain> <PackageGroupRef Id="NET40" /> <PackageGroupRef Id="RSA_Application" /> </Chain> </Bundle> ...
I am including the
<PropertyRef Id="NETFRAMEWORK40FULL" />
in the fragment and then going on to define the ExePackage for .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" /> <!-- Everything else is an error --> </ExePackage> ...
I have also checked the Visual Studio build output to confirm that the
WixNetFxExtension.dll
is referenced correctly: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 with the
DetectCondition
property. No matter what I set it to, it evaluates tofalse
.Thinking that maybe the
NETFRAMEWORK40FULL
reference cannot be trusted, I tried using 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"
orDetectCondition="isInstalled = true"
always evaluates to false. Even settingDetectCondition="true"
always evaluates to false!Here is a log snippet of what I am 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.
Specifically,
i052: Condition 'true' evaluates to false.
and actuallyCondition 'NOT NETFRAMEWORK40FULL' evaluates to true.
even though I have .NET 4.0 Full installed and can manually find the .NET 4.0 entry in my registry, both in the usual spot and underHKLM\SOFTWARE\Wow6432Node
(I am on a 64 bit system).Am I missing something? Why doesn't DetectCondition work for me? The project compiles, runs, deploys the payload(s) and otherwise works fine.
-
Terrabits about 11 yearsHuh. I did not realize
NETFRAMEWORK40FULL
was an MSI property. Thanks. Maybe that is causing the logic error? Still haven't figured that part out, althoughNetFx40Redist
avoids that issue altogether. Any thoughts on this? I shied away from using<PackageGroupRef Id="NetFx40Redist" />
because I wanted to control the installation attributes of the package. I decided to stop being stubborn and give it a shot (at your suggestion) and so far it is working out for me; I guess the default settings are fine. Thanks for your help :-) -
Bob Arnson about 11 yearsYes, you can't use an MSI property in a Burn expression. That requires a Burn variable.
-
Brandon over 8 yearsThe fact that "Bundle" variables can't be used in MSIs makes no sense whatsoever. Why even have them?
-
AJ Richardson about 8 yearsIf you want to detect versions above 4.5, you need to use the "Release" value (instead of "Version") because it is numeric. This page shows how to use it: msdn.microsoft.com/en-CA/library/hh925568(v=vs.110).aspx
-
user492238 over 5 yearsHere is an updated link to WIX expression syntax in condition statements: firegiant.com/wix/tutorial/com-expression-syntax-miscellanea/…