Search code examples
crystal-reportswixwindows-installerbootstrapperburn

Wix Burn Bootstrapper Uninstalling Crystal Report on Major Upgrade


I am using wix burn for my bootstrapper and every time I have upgrade to my application Crystal Reports runtime gets uninstalled. Can someone please help me fix this?

Bundle.wxs

 <?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">

  <?include Variables.wxi ?>

  <Bundle Name="!(loc.BundleName)"
          Version="$(var.Version)"
                Manufacturer="!(loc.Manufacturer)"
                HelpTelephone="!(loc.HelpPhone)"
                Copyright="!(loc.Copyright)"
          UpgradeCode="$(var.UpgradeCode)"
          IconSourceFile="$(var.MainApplicationImagesFolder)\Car_Count_Report_Flat.ico" >
    <!--SplashScreenSourceFile="$(var.MainApplicationImagesFolder)\BurnSplashScreen.bmp" >-->

    <bal:Condition Message="This install requires Windows 7 Service Pack 1 or Higher">
      ((VersionNT >= v6.1) AND (ServicePackLevel >= 1) OR (VersionNT >= v6.3))
    </bal:Condition>

    <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
    <WixVariable Id="WixStdbaLicenseRtf" Value="$(var.EULAFolder)\EULA_en-US.rtf" />
    <WixVariable Id="WixStdbaLogo" Value="$(var.MainApplicationImagesFolder)\car_counter_report_icon_64.png" />

    <!-- Checks the Crystal Reports Registry Values -->
    <!--<util:RegistrySearch Root="HKLM" Key="SOFTWARE\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Crystal Reports"
                      Value="CRRuntime64Version" Format="raw" Variable="CRRuntime64Version" Result="value" Win64="yes"/>-->

    <util:RegistrySearch Root="HKLM" Key="SOFTWARE\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Crystal Reports"
                         Value="CRRuntime32Version" Format="raw" Variable="CRRuntime32Version" Result="value"/>

    <!-- Checks the Main Application Registry Values -->
    <!--<util:RegistrySearch Root="HKLM" Key="Software\Saunders Creative Strategies\Kaady\Car Count Report"
                        Value="Version" Format="raw" Variable="x64Version" Result="value" Win64="yes"/>-->

    <util:RegistrySearch Root="HKLM" Key="Software\Saunders Creative Strategies\Kaady\Car Count Report"
                         Value="Version" Format="raw" Variable="x86Version" Result="value"/>

    <!-- Adds Local Variables -->
    <Variable Name="CRRUNTIMEUPGRADE" bal:Overridable="yes" Type="numeric" Value="1" />

    <Chain>
      <!-- TODO: Define the list of chained packages. -->
      <!-- <MsiPackage SourceFile="path\to\your.msi" /> -->
      <PackageGroupRef Id="NetFx45Redist"/>
      <PackageGroupRef Id ="CrystalReportsRuntime"/>
      <PackageGroupRef Id="MainApplicationFile"/>
    </Chain>
  </Bundle>
</Wix>

InstallationFiles.wxs

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">

  <?include Variables.wxi ?>
  <Fragment>
    <!-- Crystal Reports Runtime -->
    <PackageGroup Id="CrystalReportsRuntime">

      <!--<?if $(var.Platform) = x64 ?>--><!--
      --><!--<MsiPackage Id ="CRRuntime64"
                   DownloadUrl="$(var.CRHttp)/$(var.CRx64Msi)"
                   SourceFile="$(var.3rdPartyApplicationFiles)\$(var.CRx64Msi)"
                   Name="$(var.CRx64Msi)"
                   Vital ="yes"
                   Compressed="no"
                   ForcePerMachine="yes"
                   InstallCondition="NOT CRRuntime64Version OR (CRRuntime64Version &lt; &quot;$(var.CRVersion)&quot;)" >
        <MsiProperty Name="UPGRADE" Value="[CRRUNTIMEUPGRADE]" />
      </MsiPackage>--><!--
      --><!--<?else ?>-->
      <MsiPackage Id ="CRRuntime32"
                DownloadUrl="$(var.CRHttp)/$(var.CRx86Msi)"
                SourceFile="$(var.3rdPartyApplicationFiles)\$(var.CRx86Msi)"
                Name="$(var.CRx86Msi)"
                Vital ="yes"
                Compressed="no"
                ForcePerMachine="yes"
                Visible="yes" 
                Permanent="yes"
                InstallCondition="NOT CRRuntime32Version AND (NOT (CRRuntime32Version = &quot;$(var.CRVersion)&quot;))" >
        <MsiProperty Name="UPGRADE" Value="[CRRUNTIMEUPGRADE]" />
      </MsiPackage>
      <!--<?endif ?>-->
    </PackageGroup>

    <PackageGroup Id="MainApplicationFile">
      <!--<MsiPackage Id="MainApplicationx64Msi" Vital="yes" Compressed="yes" ForcePerMachine="yes" Cache="yes"
                 Name="$(var.Mainx64Msi)"
                 InstallCondition="NOT x64Version OR (x64Version &lt; &quot;$(var.Version)&quot;)"
                 SourceFile="$(var.MainApplicationx64MsiFile)\$(var.Mainx64Msi)"/>-->

      <MsiPackage Id="MainApplicationx86Msi" Vital="yes" Compressed="yes" ForcePerMachine="yes" Cache="yes"
                  Name="$(var.Mainx86Msi)" 
                  Visible="no"
                  InstallCondition="NOT x86Version OR (x86Version &lt; &quot;$(var.Version)&quot;)"
                  SourceFile="$(var.MainApplicationx86MsiFile)\$(var.Mainx86Msi)"/>
    </PackageGroup>
  </Fragment>
</Wix>

Thank you Shane


Solution

  • If you look at the install log in the user's temp directory, you would see that the upgrade bundle doesn't think it should install the CRRuntime32 because the InstallCondition is false. Burn uses the MSI's upgrade table to do the same logic that you're trying to do. If the Crystal Reports MSI is authored correctly, you should be able to just drop your install condition and let Burn decide whether it needs to be installed.