Wix Burn仅在安装时才安装.Net 4.5.1 .Net版本较低且不高

时间:2016-06-27 08:32:36

标签: .net installation wix burn

我们将.Net 4.5.1作为我们软件套件的先决条件。在我们撰写刻录时,我们将.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>

2 个答案:

答案 0 :(得分:2)

您应该使用 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>

答案 1 :(得分: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)"
相关问题