【问题标题】:Wix Burn install .Net 4.5.1 only if installed .Net version is lower and not higherWix Burn 安装 .Net 4.5.1 仅在安装的 .Net 版本较低而不是较高的情况下
【发布时间】:2016-06-27 08:32:35
【问题描述】:

我们有 .Net 4.5.1 作为我们软件套件的先决条件。在我们编写 burn 时,我们拥有 .net 4.5.1 作为最新版本,因此我们不必检查更高版本的安装。现在我们在 pc 中有 4.6.X 或更高版本的 .Net 版本,我们的设置总是尝试安装 .Net 4.5.1。那么,如何检查是否安装了更高版本并跳过.Net安装?

我们不使用网络安装。安装文件将以 .exe 格式提供,供刻录访问。这是当前的创作代码。

<WixVariable Id="WixMbaPrereqPackageId" Value="Netfx451Full" />
<WixVariable Id="WixMbaPrereqLicenseUrl" Value="$(var.NetFx40EulaLink)" />

<util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full" Value="Version"
                     Variable="Net4FullVersion" />
<util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full" Value="Version"
                     Variable="Net4x64FullVersion" Win64="yes" />

<PackageGroup Id="Netfx451Full">
  <ExePackage Id="Net45" Name="Microsoft .NET Framework 4.5.1.exe"
              Description="Microsoft .NET Framework 4.5.1 AllOS (x86 and x64) Setup"
              Cache="no" Compressed="no" PerMachine="yes" Permanent="yes" Vital="yes"
              InstallCommand="/norestart"
              SourceFile="$(var.PreRequisites_x86)DotNetFramework\NDP451-KB2858728-x86-x64-AllOS-ENU.exe"
              DetectCondition="(Net4FullVersion = &quot;4.5.50938&quot;) AND (NOT VersionNT64 OR (Net4x64FullVersion = &quot;4.5.50938&quot;))"
              InstallCondition="(VersionNT >= v6.1 OR VersionNT64 >= v6.1) AND (NOT (Net4FullVersion = &quot;4.5.50938&quot; OR Net4x64FullVersion = &quot;4.5.50938&quot;))" />
</PackageGroup>

【问题讨论】:

    标签: .net installation wix burn


    【解决方案1】:

    您应该使用 WixNetFxExtension 中的功能:http://wixtoolset.org/documentation/manual/v3/howtos/redistributables_and_install_checks/install_dotnet.html

    再看看这个: Installing .NET redistributable with Wix Bootstrapper (Burn)

    只需添加这个(不需要条件):

    <Chain>
        <PackageGroupRef Id="NetFx451Redist" />
        <MsiPackage SourceFile="$(var.AppInstaller.TargetPath)" />
    </Chain>
    

    【讨论】:

    【解决方案2】:

    你真的应该使用builtin packages。如果不是,至少以their source code为基础:

    <?define NetFx451MinRelease = 378675 ?>
    
    ...
    
    <Fragment> 
      <util:RegistrySearchRef Id="NETFRAMEWORK45"/> 
    
      ...
    
      <WixVariable Id="NetFx451WebDetectCondition"
                   Value="NETFRAMEWORK45 &gt;= $(var.NetFx451MinRelease)"
                   Overridable="yes" />
    
      ...
    
      DetectCondition="!(wix.NetFx451WebDetectCondition)"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-30
      • 1970-01-01
      • 2023-03-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多