wix - 如何判断WIX Bootstrapper中是否安装了dotnet和VSTORuntime

标签 wix bootstrapper wix3.7

我使用 Wix 创建了我的插件项目的安装文件。它有一些依赖项,如 dotNet 和 VSTO Runtime。所以我使用 Wix Bootstrap 来确认在安装它也可以工作的产品之前必须安装依赖项。但我需要有条件地安装依赖项,例如如果安装了 dotNet 和 VSTO 运行时,则不要寻找安装这些项目。我也尝试了注册表搜索但没有成功,这是我的 Bootstrap 代码,告诉我在哪里需要修改我的代码。

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

最佳答案

问题是我忘记使用导致此问题的值属性。这是 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>

关于wix - 如何判断WIX Bootstrapper中是否安装了dotnet和VSTORuntime,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16557725/

相关文章:

WiX 3.8 : Create an . EXE 安装程序

wix - 在 Visual Studio 环境中将第一个自定义对话框添加到 WIX

从 Visual Studio 2010 构建时缺少 Wix darice.cub 文件

wpf - Caliburn Micro 中的 Bootstrap

wix - 在 WIX 中运行时为快捷方式动态分配名称

windows - WiX:命令提示符的不完整快捷方式

windows - Wix - 在安装结束时运行一个 exe(带参数),当前 MSI 没有安装它

WIX Burn Bootstrapper 不要求我的 MSI 的管理员权限

wix 生成新的升级代码

c# - 什么是 C# 中的 Bootstrappers/Bootstrapping