Wix Burn Bootstrapper 卸载 Crystal 重大升级报告

Wix Burn Bootstrapper Uninstalling Crystal Report on Major Upgrade

我正在为我的引导程序使用 wix burn,每次我升级到我的应用程序时 Crystal Reports runtime 都会被卸载。有人可以帮我解决这个问题吗?

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>

谢谢 谢恩

您应该使用 DetectCondition 而不是 InstallCondition。第一个回答:安装了吗?第二:对于捆绑安装,是否需要?

按照您的方式,当安装过程中出现 CR 时,burn 会删除它,因为逻辑上说不需要它。

如果您查看用户临时目录中的安装日志,您会发现升级包认为它不应安装 CRRuntime32,因为 InstallCondition 为假。 Burn 使用 MSI 的升级 table 来执行与您尝试执行的相同的逻辑。如果 Crystal Reports MSI 编写正确,您应该可以只删除安装条件,让 Burn 决定是否需要安装它。