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

查看:131
本文介绍了使用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版本和Service Pack?

假设我在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天全站免登陆