如何确定是否在WIX Bootstrapper中安装了dotnet和VSTORuntime

时间:2013-05-15 05:46:39

标签: wix bootstrapper wix3.7

我使用wix创建了我的加载项目的安装文件。它有一些依赖,如dotNet和VSTO Runtime。所以我使用Wix bootstrapper确认必须安装依赖项,然后再安装它也能运行的产品。但我需要条件安装依赖项,如果安装了dotNet和VSTO运行时,那么不要寻找安装这些项目。我也尝试了注册表搜索,但没有成功,这是我的bootstrapper代码告诉我在哪里需要修改我的代码。

<?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">
    <Bundle Name="FinalSetup" Version="1.0.0.0" Manufacturer="Ramesh" UpgradeCode="5704ca64-b7bc-487b-8867-cabb51621c0e">
    <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" >
      <bal:WixStandardBootstrapperApplication LicenseFile="mylicense.rtf"
                                              SuppressOptionsUI="yes" />
    </BootstrapperApplicationRef>

        <Chain>
      <ExePackage Id="dotNetFx40_Full_x86_x64" SourceFile="dotNetFx40_Full_x86_x64.exe" PerMachine="yes" Cache="no"
                  Compressed="no"
                  DownloadUrl="http://download.microsoft.com/download/9/5/A/95A9616B-7A37-4AF6-BC36-D6EA96C8DAAE/dotNetFx40_Full_x86_x64.exe"
                  Permanent="yes"
                  InstallCommand="/q /norestart"
                  DetectCondition="VSTOR40_Installed"
                  InstallCondition="1" />
      <ExePackage Id="VSTORuntime" SourceFile="vstor_redist.exe" Permanent="yes" Vital="yes" Cache="no" Compressed="no"
                  DownloadUrl="http://go.microsoft.com/fwlink/?LinkId=158917"
                  PerMachine="yes"
                  InstallCommand="/q /norestart"
                  DetectCondition="VSTOR40_Installed"
                  InstallCondition="NOT VSTOR40_Installed" />
      <MsiPackage SourceFile="$(var.Setup.TargetPath)" Vital="yes" Compressed="yes" Id="WordAddIns" After="VSTORuntime"/>
    </Chain>
    </Bundle>
</Wix>

我遇到的另一个问题是,我附加了mylicense.rft,其中包含一些虚拟内容。但安装程序在安装过程中未显示许可证内容,请查看附加的快照 enter image description here

1 个答案:

答案 0 :(得分:3)

问题是我忘记使用导致此问题的value属性。这是rtf文件的问题,在更改文件后按预期工作。 这是代码的工作版本。

工作版本在这里

<?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">
  <Bundle Name="FinalSetup" Version="1.0.0.0" Manufacturer="Ramesh" UpgradeCode="5704ca64-b7bc-487b-8867-cabb51621c0e">
    <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" >
      <bal:WixStandardBootstrapperApplication LicenseFile="mylicense.rtf"
                                              SuppressOptionsUI="yes" />
    </BootstrapperApplicationRef>
    <util:RegistrySearch Id="VSTORuntimeTest" Root="HKLM" Key="SOFTWARE\Microsoft\VSTO Runtime Setup\v4R\" Value="VSTORFeature_CLR40" Variable="VSTORFeature"/>
    <util:RegistrySearch Id="VSTORuntimeVersionV4R" Root="HKLM" Key="SOFTWARE\Microsoft\VSTO Runtime Setup\v4R\" Value="Version" Variable="VSTORVersionV4R"/>
    <util:RegistrySearch Id="VSTORuntimeVersionV4" Root="HKLM" Key="SOFTWARE\Microsoft\VSTO Runtime Setup\v4\" Value="Version" Variable="VSTORVersionV4"/>

    <util:RegistrySearch Id="DotNetTest" Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full" Value="Install" Variable="DotNetInstall"/>
    <util:RegistrySearch Id="DotNetVersion" Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full" Value="Version" Variable="DotNetVersion"/>

    <Chain> 
      <ExePackage Id="dotNetFx40_Full_x86_x64" SourceFile="dotNetFx40_Full_x86_x64.exe" PerMachine="yes" Cache="no"
                  Compressed="no"
                  DownloadUrl="http://download.microsoft.com/download/9/5/A/95A9616B-7A37-4AF6-BC36-D6EA96C8DAAE/dotNetFx40_Full_x86_x64.exe"
                  Permanent="yes"
                  InstallCommand="/q /norestart"
                  DetectCondition="NOT DotNetInstall"
                  InstallCondition="NOT DotNetInstall OR NOT (DotNetVersion >=v4.0.30319)" />
      <ExePackage Id="VSTORuntime" SourceFile="vstor_redist.exe" Permanent="yes" Vital="yes" Cache="no" Compressed="no"
                  DownloadUrl="http://go.microsoft.com/fwlink/?LinkId=158917"
                  PerMachine="yes"
                  InstallCommand="/q /norestart"
                  DetectCondition="VSTORFeature"
                  InstallCondition="NOT VSTORFeature OR NOT (VSTORVersionV4R >=v10.0.40303) OR NOT (VSTORVersionV4 >=v10.0.21022)" />
      <MsiPackage SourceFile="$(var.Setup.TargetPath)" Vital="yes" Compressed="yes" Id="WordAddIns"/>
    </Chain>
  </Bundle>
</Wix>