Click here to Skip to main content
15,067,335 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
Hi,
I am trying to create an installer that checks for .net framework and Access Database Engine, if not exist, install them.
Here is my bundle.wxs;

XML
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" 
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"> 
  <Bundle Name="X" Version="X" Manufacturer="X"
          UpgradeCode="e5262915-9847-495b-8be3-6c9624e0b65e">
    <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
    <Chain>
      <!-- TODO: Define the list of chained packages. -->
      <PackageGroupRef Id="Netfx4Full"/>
      <PackageGroupRef Id="AccessDatabaseEngine4Fullx64"/>
      <PackageGroupRef Id="AccessDatabaseEngine4Full"/>
      <MsiPackage Id="MyApplication1" SourceFile="$(var.MySetup.TargetPath)"/> 
    </Chain> 
  </Bundle>  
  <Fragment>
     
                         
    <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="Netfx40x64FullVersion"
                         Win64="yes" />
    <util:RegistrySearch Root="HKLM"
                         Key="SOFTWARE\Microsoft\Office\14.0\Access Connectivity Engine\InstallRoot"
                         Value="Path"
                         Variable="AcccessDatabaseEnginex64"/>
    <util:RegistrySearch Root="HKLM"
                         Key="SOFTWARE\Microsoft\Office\14.0\Access Connectivity Engine\InstallRoot"
                         Value="Path"
                         Variable="AcccessDatabaseEngine"
                         Win64="yes"/>
    
     <!--Check for .NET 4.0-->
    <PackageGroup Id="AccessDatabaseEngine4Fullx64">
      <ExePackage Id="AccessDatabaseEngine4Fullx64"
                  DisplayName="Microsoft Access Database Engine(x64)"
                  DownloadUrl="http://download.microsoft.com/download/2/4/3/24375141-E08D-4803-AB0E-10F2E3A07AAA/AccessDatabaseEngine_x64.exe"
                  Compressed="no"
                  Cache="yes"
                  PerMachine="yes"
                  Permanent="yes"
                  Protocol="netfx4"
                  Vital="yes"
                  SourceFile=".\Access\AccessDatabaseEngine_x64.exe"
                  DetectCondition="NOT AcccessDatabaseEnginex64 OR NOT AcccessDatabaseEnginex"/>
    </PackageGroup>
    
    <PackageGroup Id="AccessDatabaseEngine4Full">
          <ExePackage Id="AccessDatabaseEngine4Full"
                  DisplayName="Microsoft Access Database Engine"
                  DownloadUrl="http://download.microsoft.com/download/2/4/3/24375141-E08D-4803-AB0E-10F2E3A07AAA/AccessDatabaseEngine.exe"
                  Compressed="no"
                  Cache="yes"
                  PerMachine="yes"
                  Permanent="yes"
                  Protocol="netfx4"
                  Vital="yes"
                  SourceFile=".\Access\AccessDatabaseEngine.exe"
                  DetectCondition="NOT AcccessDatabaseEngine OR NOT AcccessDatabaseEnginex64"/>
    </PackageGroup>
    
    <PackageGroup Id="Netfx4Full">      
      <ExePackage Id="Netfx4Full"
                  DisplayName="Microsoft .NET Framework 4.5"
                  DownloadUrl="http://download.microsoft.com/download/9/5/A/95A9616B-7A37-4AF6-BC36-D6EA96C8DAAE/dotNetFx40_Full_x86_x64.exe"
                  Compressed="no"
                  Cache="yes"
                  PerMachine="yes"
                  Permanent="yes"
                  Protocol="netfx4"
                  Vital="yes"
                  SourceFile=".\Access\dotNetFx40_Full_x86_x64.exe"
                  InstallCommand="/passive /norestart"
                  DetectCondition="NOT Netfx4FullVersion AND NOT Netfx40x64FullVersion"/>
    </PackageGroup> 
  
  </Fragment> 
</Wix> 

However; Even though I have .net framework is installed, it still tries to install it and with access database engine, I have this error
Posted
Updated 6-Jan-17 8:50am
v2

1 solution

Your detect condition is wrong, you see the way the detect condition works is if it returns false then it will be installed. In this specific case:

HTML
<ExePackage Id="AccessDatabaseEngine4Fullx64"
                  DisplayName="Microsoft Access Database Engine(x64)"
                  DownloadUrl="http://download.microsoft.com/download/2/4/3/24375141-E08D-4803-AB0E-10F2E3A07AAA/AccessDatabaseEngine_x64.exe"
                  Compressed="no"
                  Cache="yes"
                  PerMachine="yes"
                  Permanent="yes"
                  Protocol="netfx4"
                  Vital="yes"
                  SourceFile=".\Access\AccessDatabaseEngine_x64.exe"
                  DetectCondition="NOT AcccessDatabaseEnginex64 OR NOT AcccessDatabaseEnginex"/>


Burn will only install this package if the detect condition is false meaning that it will only try to install it if both packages are already installed. The correct way would be:

HTML
<ExePackage Id="AccessDatabaseEngine4Fullx64"
                  DisplayName="Microsoft Access Database Engine(x64)"
                  DownloadUrl="http://download.microsoft.com/download/2/4/3/24375141-E08D-4803-AB0E-10F2E3A07AAA/AccessDatabaseEngine_x64.exe"
                  Compressed="no"
                  Cache="yes"
                  PerMachine="yes"
                  Permanent="yes"
                  Protocol="netfx4"
                  Vital="yes"
                  SourceFile=".\Access\AccessDatabaseEngine_x64.exe"
                  DetectCondition="AcccessDatabaseEnginex64 OR AcccessDatabaseEnginex"/>


Now it will install Access Database Engine X64 only if any of the two version AREN'T installed already.
   
Comments
Dave Kreskowiak 6-Jan-17 15:26pm
   
Ummm...I seriously doubt the OP is still looking for an answer THREE YEARS LATER.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900