使用 WIX 安装程序安装 .NET Framework 4.7.2(如果需要) [英] Install .NET Framework 4.7.2 (if needed) with WIX installer

查看:31
本文介绍了使用 WIX 安装程序安装 .NET Framework 4.7.2(如果需要)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

帮助!我继承了一个带有 WIX 安装程序项目的 .NET 项目.他们隐含地假设每台机器上都安装了 .NET Framework 4.5,这在很大程度上是正确的.现在我们正在添加一些需要 .NET Framework 4.7.2 的功能.我想修改安装集以检查是否存在 4.7.2(或更高版本)并在必要时通过 Web 安装.我发现一些文档部分回答了我的问题,但我仍然很困惑如何开始以及如何填写细节.是否有任何完整的演示或说明可用?我的理解是我需要添加一个BootStrapper"项目.如果我从我的主安装(我现有的安装)中添加/引用 BootStrapper 项目,或者如果我将主安装引用为 Bootstrapper 项目的一部分(通过 MsiPackage 元素),我会感到困惑.另外,如何设置检查 4.7.2?我发现的所有参考都是针对 4.5 或更早版本的,并且显然注册表中用于检查的位置已更改:

Help! I've inherited a .NET project with a WIX installer project. They make the implicit assumption that .NET Framework 4.5 is installed on each machine which for the most part is true. Now we are adding some features that require .NET Framework 4.7.2 . I'd like to modify the install set to check for the presence of 4.7.2 (or higher) and install via web if necessary. I've found some documentation that's partially answered my questions but I'm still very confused how to get started and how to fill in the specifics. Are there any complete demos or instructions available? My understanding is that I need to add a "BootStrapper" project. I'm confused if I then add/reference the BootStrapper project from my main install (my existing install) OR if I reference the main install as part of the Bootstrapper project (via MsiPackage element). Also, how do I set things up to check for 4.7.2? All the references I found were for 4.5 or earlier and apparently the place in the registry for checking has changed:

我该怎么做检测安装了哪些 .NET Framework 版本和服务包?

假设我在 Bootstrapper 中引用了我的主要安装,我该怎么做?

Assuming I refer to my main install in the Bootstrapper, how do I do this?

这些是我为感兴趣的人找到的链接.他们都暗示了答案,但没有给出完整的答案和/或已经过时了.

These are the links I've found for those interested. They all hint at the answers, but don't give complete answers and/or are out of date.

http://wixtoolset.org/documentation/manual/v3/howtos/redistributables_and_install_checks/install_dotnet.html

https://www.firegiant.com/wix/tutorial/net-and-net/bootstrapping/

https://wix.ronifuchs.com/

最后,我相信我使用的是 WIX Toolset v3.11.这是文件夹指示的内容(C:Program Files (x86)WiX Toolset v3.11)

Finally, I believe I am using WIX Toolset v3.11. This is what the folder indicates (C:Program Files (x86)WiX Toolset v3.11)

之所以提到这一点,是因为一些参考资料是指 Wix 4.0(例如:http://wixtoolset.org/releases/"/>)

I mention this because some of the reference material refers to Wix 4.0 (Example: http://wixtoolset.org/releases/" />)

谢谢!

推荐答案

一张票被打开了这里 去年提供了一种解决方法:

A ticket was opened here last year and a workaround has been provided:

  <?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">

  <!--
        .NET Framework installation state properties

        Official documentation can be found at the following location:

           .NET Framework 4.5/4.5.1/4.5.2/4.6/4.6.1/4.6.2/4.7/4.7.1 - http://msdn.microsoft.com/en-us/library/w0x726c2(v=vs.110).aspx
    -->

  <?define NetFx471MinRelease = 461308 ?>
  <?define NetFx471WebLink = http://go.microsoft.com/fwlink/?LinkId=852092 ?>
  <?define NetFx471RedistLink = http://go.microsoft.com/fwlink/?LinkId=852104 ?>
  <?define NetFx471EulaLink = http://referencesource.microsoft.com/license.html ?>

  <Fragment>
    <PropertyRef Id="WIXNETFX4RELEASEINSTALLED" />
    <Property Id="WIX_IS_NETFRAMEWORK_471_OR_LATER_INSTALLED" Secure="yes" />
    <SetProperty Id="WIX_IS_NETFRAMEWORK_471_OR_LATER_INSTALLED" Value="1" After="AppSearch">
      WIXNETFX4RELEASEINSTALLED >= "#$(var.NetFx471MinRelease)"
    </SetProperty>
  </Fragment>

  <Fragment>
    <util:RegistrySearchRef Id="NETFRAMEWORK45"/>

    <WixVariable Id="WixMbaPrereqPackageId" Value="NetFx471Web" />
    <WixVariable Id="WixMbaPrereqLicenseUrl" Value="$(var.NetFx471EulaLink)" Overridable="yes" />
    <WixVariable Id="NetFx471WebDetectCondition" Value="NETFRAMEWORK45 &gt;= $(var.NetFx471MinRelease)" Overridable="yes" />
    <WixVariable Id="NetFx471WebInstallCondition" Value="" Overridable="yes" />
    <WixVariable Id="NetFx471WebPackageDirectory" Value="redist" Overridable="yes" />

    <PackageGroup Id="NetFx471Web">
      <ExePackage
          InstallCommand="/q /norestart /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx471FullLog].html&quot;"
          RepairCommand="/q /norestart /repair /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx471FullLog].html&quot;"
          UninstallCommand="/uninstall /q /norestart /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx471FullLog].html&quot;"
          PerMachine="yes"
          DetectCondition="!(wix.NetFx471WebDetectCondition)"
          InstallCondition="!(wix.NetFx471WebInstallCondition)"
          Id="NetFx471Web"
          Vital="yes"
          Permanent="yes"
          Protocol="netfx4"
          DownloadUrl="$(var.NetFx471WebLink)"
          LogPathVariable="NetFx471FullLog"
          Compressed="no"
          Name="!(wix.NetFx471WebPackageDirectory)NDP471-KB4033344-Web.exe">
        <RemotePayload
          CertificatePublicKey="2ECAEC21B884B40A7C5FB141D2CBC4CDA4930752"
          CertificateThumbprint="49D59D86505D82942A076388693F4FB7B21254EE"
          Description="Microsoft .NET Framework 4.7.1 Setup"
          Hash="C0919415622D86C3D6AB19F0F92EA938788DB847"
          ProductName="Microsoft .NET Framework 4.7.1"
          Size="1434504"
          Version="4.7.2558.0" />
      </ExePackage>
    </PackageGroup>
  </Fragment>

  <Fragment>
    <util:RegistrySearchRef Id="NETFRAMEWORK45"/>

    <WixVariable Id="WixMbaPrereqPackageId" Value="NetFx471Redist" />
    <WixVariable Id="WixMbaPrereqLicenseUrl" Value="$(var.NetFx471EulaLink)" Overridable="yes" />
    <WixVariable Id="NetFx471RedistDetectCondition" Value="NETFRAMEWORK45 &gt;= $(var.NetFx471MinRelease)" Overridable="yes" />
    <WixVariable Id="NetFx471RedistInstallCondition" Value="" Overridable="yes" />
    <WixVariable Id="NetFx471RedistPackageDirectory" Value="redist" Overridable="yes" />

    <PackageGroup Id="NetFx471Redist">
      <ExePackage
          InstallCommand="/q /norestart /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx471FullLog].html&quot;"
          RepairCommand="/q /norestart /repair /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx471FullLog].html&quot;"
          UninstallCommand="/uninstall /q /norestart /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx471FullLog].html&quot;"
          PerMachine="yes"
          DetectCondition="!(wix.NetFx471RedistDetectCondition)"
          InstallCondition="!(wix.NetFx471RedistInstallCondition)"
          Id="NetFx471Redist"
          Vital="yes"
          Permanent="yes"
          Protocol="netfx4"
          DownloadUrl="$(var.NetFx471RedistLink)"
          LogPathVariable="NetFx471FullLog"
          Compressed="no"
          Name="!(wix.NetFx471RedistPackageDirectory)NDP471-KB4033342-x86-x64-AllOS-ENU.exe">
        <RemotePayload
          CertificatePublicKey="2ECAEC21B884B40A7C5FB141D2CBC4CDA4930752"
          CertificateThumbprint="49D59D86505D82942A076388693F4FB7B21254EE"
          Description="Microsoft .NET Framework 4.7.1 Setup"
          Hash="5F0597CEADDBDF3BAD24CA6EBE142BD81C2DF713"
          ProductName="Microsoft .NET Framework 4.7.1"
          Size="68742112"
          Version="4.7.2558.0" />
      </ExePackage>
    </PackageGroup>
  </Fragment>
</Wix>

然后你需要在 bundle.wxs 中添加这个:

and then in bundle.wxs you need to add this:

  <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">

  <Bundle Name="..."
          Version="..." 
          Manufacturer="..." 
          UpgradeCode="..." 
          >

    <Chain>      

      <!--Install .Net Framework 4.7.1-->
      <PackageGroupRef Id="NetFx471Redist"/>

      <!--Install Product-->
      <MsiPackage
        Id="Setup"   
        DisplayInternalUI="yes"
        Compressed="yes"
        SourceFile="..."
        Vital="yes">        
      </MsiPackage>     

    </Chain>
  </Bundle>  
</Wix>

这篇关于使用 WIX 安装程序安装 .NET Framework 4.7.2(如果需要)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆