救命!
我已经用WIX安装程序项目继承了一个.NET项目。他们隐式地假设在每台计算机上都安装了.NET Framework 4.5,这在大多数情况下是正确的。现在,我们添加了一些需要.NET Framework 4.7.2的功能。我想修改安装集以检查是否存在4.7.2(或更高版本),并在必要时通过Web安装。我发现一些文档部分地回答了我的问题,但是我仍然很困惑如何入门以及如何填写具体内容。是否有完整的演示或说明?我的理解是,我需要添加一个“BootStrapper”项目。如果我随后从主安装(现有安装)中添加/引用BootStrapper项目,或者将其作为Bootstrapper项目的一部分引用(通过MsiPackage元素),我感到困惑。另外,如何设置要检查4.7.2的内容?我发现的所有引用都是针对4.5或更早版本的,显然注册表中用于检查的位置已更改:

How do I detect what .NET Framework versions and service packs are installed?

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

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

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)

我之所以这样说是因为某些引用资料是指Wix 4.0(例如:http://wixtoolset.org/releases/“/>)

谢谢!

最佳答案

去年在here开了一张票,并提供了一种解决方法:

  <?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中,您需要添加以下内容:
  <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>

关于c# - 使用WIX安装程序安装.NET Framework 4.7.2(如果需要),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/53640255/

10-17 01:03