[wix-users] EXT: Install .Net 4.8 if it's not installed as a condition

Vanniekerk, Tyrel (GE Healthcare) tyrel.vanniekerk at ge.com
Tue May 5 08:54:57 PDT 2020


I have my custom UI bootstrapper set to use .NET 4.8 and that seems to trigger it nicely.  I also have a Wix shared library with the code to install 4.8.  We have a requirement to install without Internet, so the command is set up that way.  It would be different if you needed it to download from the Internet.

The NetFx48.wxs that I use is below.

I set the variable to point to my prerequisites folder:
    <WixVariable Id="NetFx48RedistPackageDirectory" Value="Prerequisites\" />

And then have the package group ref:
      <PackageGroupRef Id="NetFx48Redist" />

Hope that helps.

<?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/4.8 - https://msdn.microsoft.com/en-us/library/w0x726c2(v=vs.110).aspx
   -->

  <?define NetFx48MinRelease = 528040 ?>
  <?define NetFx48WebLink = https://go.microsoft.com/fwlink/?LinkId=2085155 ?>
  <?define NetFx48RedistLink = https://go.microsoft.com/fwlink/?linkid=2088631 ?>
  <?define NetFx48EulaLink = https://referencesource.microsoft.com/license.html ?>

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

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

    <WixVariable Id="WixMbaPrereqPackageId" Value="NetFx48Web" />
    <WixVariable Id="WixMbaPrereqLicenseUrl" Value="$(var.NetFx48EulaLink)" Overridable="yes" />
    <WixVariable Id="NetFx48WebDetectCondition" Value="NETFRAMEWORK45 >= $(var.NetFx48MinRelease)" Overridable="yes" />
    <WixVariable Id="NetFx48WebInstallCondition" Value="" Overridable="yes" />
    <WixVariable Id="NetFx48WebPackageDirectory" Value="redist\" Overridable="yes" />

    <PackageGroup Id="NetFx48Web">
      <ExePackage
          InstallCommand="/q /norestart /ChainingPackage "[WixBundleName]" /log "[NetFx48FullLog].html""
          RepairCommand="/q /norestart /repair /ChainingPackage "[WixBundleName]" /log "[NetFx48FullLog].html""
          UninstallCommand="/uninstall /q /norestart /ChainingPackage "[WixBundleName]" /log "[NetFx48FullLog].html""
          PerMachine="yes"
          DetectCondition="!(wix.NetFx48WebDetectCondition)"
          InstallCondition="!(wix.NetFx48WebInstallCondition)"
          Id="NetFx48Web"
          Vital="yes"
          Permanent="yes"
          Protocol="netfx4"
          DownloadUrl="$(var.NetFx48WebLink)"
          LogPathVariable="NetFx48FullLog"
          Compressed="no"
          Name="!(wix.NetFx48WebPackageDirectory)ndp48-web.exe">
        <RemotePayload
          CertificatePublicKey="D17AFCE951979605250FAEBAFA7AE974899AED22"
          CertificateThumbprint="C82273A065EC470FB1EBDE846A91E6FFB29E9C12"
          Description="Microsoft .NET Framework 4.8 Setup"
          Hash="5A84A8E612E270E27D0061D58DB6B470153BE1F9"
          ProductName="Microsoft .NET Framework 4.8"
          Size="1479400"
          Version="4.8.3928.0" />
      </ExePackage>
    </PackageGroup>
  </Fragment>

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

    <WixVariable Id="WixMbaPrereqPackageId" Value="NetFx48Redist" />
    <WixVariable Id="WixMbaPrereqLicenseUrl" Value="$(var.NetFx48EulaLink)" Overridable="yes" />
    <WixVariable Id="NetFx48RedistDetectCondition" Value="NETFRAMEWORK45 >= $(var.NetFx48MinRelease)" Overridable="yes" />
    <WixVariable Id="NetFx48RedistInstallCondition" Value="" Overridable="yes" />
    <WixVariable Id="NetFx48RedistPackageDirectory" Value="redist\" Overridable="yes" />

    <PackageGroup Id="NetFx48Redist">
      <ExePackage
          InstallCommand="/q /norestart /ChainingPackage "[WixBundleName]" /log "[NetFx48FullLog].html""
          RepairCommand="/q /norestart /repair /ChainingPackage "[WixBundleName]" /log "[NetFx48FullLog].html""
          UninstallCommand="/uninstall /q /norestart /ChainingPackage "[WixBundleName]" /log "[NetFx48FullLog].html""
          PerMachine="yes"
          DetectCondition="!(wix.NetFx48RedistDetectCondition)"
          InstallCondition="!(wix.NetFx48RedistInstallCondition)"
          Id="NetFx48Redist"
          Vital="yes"
          Permanent="yes"
          Protocol="netfx4"
          DownloadUrl="$(var.NetFx48RedistLink)"
          LogPathVariable="NetFx48FullLog"
          Compressed="no"
          Name="!(wix.NetFx48RedistPackageDirectory)ndp48-x86-x64-allos-enu.exe">
        <RemotePayload
          CertificatePublicKey="D17AFCE951979605250FAEBAFA7AE974899AED22"
          CertificateThumbprint="C82273A065EC470FB1EBDE846A91E6FFB29E9C12"
          Description="Microsoft .NET Framework 4.8 Setup"
          Hash="8DD233698D5EB4609B86C2AC917279FE39E0EF4C"
          ProductName="Microsoft .NET Framework 4.8"
          Size="117380440"
          Version="4.8.3928.0" />
      </ExePackage>
    </PackageGroup>
  </Fragment>
</Wix>

-----Original Message-----
From: wix-users <wix-users-bounces at lists.wixtoolset.org> On Behalf Of Tigran Galoyan via wix-users
Sent: Monday, May 4, 2020 7:55 PM
To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
Cc: Tigran Galoyan <tigran.galoyan at gmail.com>
Subject: EXT: [wix-users] Install .Net 4.8 if it's not installed as a condition

Hi,

I know how to check whether .Net 4.8 is installed as pre-existing condition. However, I want to install it if that's not installed yet. Has anyone gone through this path and can advise me? I'm fine to handle that either at bundle level or in the MSI package itself.

I could see it's quite easy for .Net 4.5 at bundle level in bootstrapper ( https://wixtoolset.org/documentation/manual/v3/howtos/redistributables_and_install_checks/install_dotnet.html
):

<Chain>
    <PackageGroupRef Id="NetFx45Web"/>
    <MsiPackage Id="MyApplication"
SourceFile="$(var.MyApplicationSetup.TargetPath)"/>
</Chain>


However, up to .Net 4.6.2 the package group IDs exist ( https://wixtoolset.org/documentation/manual/v3/customactions/wixnetfxextension.html).
There is no simple way for 4.8. I found a harder approach for 4.7.2, but couldn't apply to my scenario for 4.8.

Any support is much appreciated.

Thanks,
Tigran

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/



More information about the wix-users mailing list