簡體   English   中英

使用WIX安裝程序安裝.NET Framework 4.7.2(如果需要)

[英]Install .NET Framework 4.7.2 (if needed) with WIX installer

救命! 我繼承了一個帶有WIX安裝程序項目的.NET項目。 他們隱含的假設是.NET Framework 4.5安裝在每台機器上,而這些機器大部分都是正確的。 現在我們要添加一些需要.NET Framework 4.7.2的功能。 我想修改安裝集以檢查是否存在4.7.2(或更高版本),並在必要時通過Web安裝。 我發現一些文檔部分回答了我的問題,但我仍然很困惑如何開始以及如何填寫細節。 有沒有完整的演示或說明? 我的理解是我需要添加一個“BootStrapper”項目。 我很困惑,如果我然后從我的主安裝(我現有的安裝)添加/引用BootStrapper項目或者如果我引用主安裝作為Bootstrapper項目的一部分(通過MsiPackage元素)。 另外,如何設置以檢查4.7.2? 我發現的所有引用都是4.5或更早,顯然在注冊表中檢查的位置已經改變:

如何檢測安裝的.NET Framework版本和Service Pack?

假設我在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/“/>)

謝謝!

去年在這里一張票,並提供了一個解決方法:

  <?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>

我發現有點誤導,問題是關於4.7.2但是關於4.7.1版本的公認答案。

所有確切的位都在這里

剛剛在未安裝4.7.2的計算機上進行測試,所有工作都完美 - 安裝程序下載並安裝了.NET Framework組件,然后繼續進行程序安裝。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM