wixtoolset / issues

WiX Toolset Issues Tracker
http://wixtoolset.org/
129 stars 24 forks source link

NetFxExtension should support .net 4.7 #5575

Closed jon-armen closed 4 years ago

jon-armen commented 7 years ago

Feature requests

Provide support for .net 4.7 via NetFxExtension, same as all prior versions of .net

Mawe9999 commented 7 years ago

This should work. I wrote this last week, based on the existing .Net 4.6.2 NetFxExtension.

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

  <?define NetFx47MinRelease = 460798 ?>
  <?define NetFx47WebLink = http://go.microsoft.com/fwlink/?LinkId=825298 ?>
  <?define NetFx47RedistLink = http://go.microsoft.com/fwlink/?LinkId=825302 ?>
  <?define NetFx47EulaLink = http://referencesource.microsoft.com/license.html ?>

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

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

    <WixVariable Id="WixMbaPrereqPackageId" Value="NetFx47Web" />
    <WixVariable Id="WixMbaPrereqLicenseUrl" Value="$(var.NetFx47EulaLink)" Overridable="yes" />
    <WixVariable Id="NetFx47WebDetectCondition" Value="NETFRAMEWORK45 &gt;= $(var.NetFx47MinRelease)" Overridable="yes" />
    <WixVariable Id="NetFx47WebInstallCondition" Value="" Overridable="yes" />
    <WixVariable Id="NetFx47WebPackageDirectory" Value="redist\" Overridable="yes" />

    <PackageGroup Id="NetFx47Web">
      <ExePackage
          InstallCommand="/q /norestart /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx47FullLog].html&quot;"
          RepairCommand="/q /norestart /repair /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx47FullLog].html&quot;"
          UninstallCommand="/uninstall /q /norestart /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx47FullLog].html&quot;"
          PerMachine="yes"
          DetectCondition="!(wix.NetFx47WebDetectCondition)"
          InstallCondition="!(wix.NetFx47WebInstallCondition)"
          Id="NetFx47Web"
          Vital="yes"
          Permanent="yes"
          Protocol="netfx4"
          DownloadUrl="$(var.NetFx47WebLink)"
          LogPathVariable="NetFx47FullLog"
          Compressed="no"
          Name="!(wix.NetFx47WebPackageDirectory)NDP47-KB3186500-Web.exe">
        <RemotePayload
          CertificatePublicKey="371DD003A37769487A2A89A5A9DDB3026451B906"
          CertificateThumbprint="98ED99A67886D020C564923B7DF25E9AC019DF26"
          Description="Microsoft .NET Framework 4.7 Setup"
          Hash="B3A24DEB7A8D937FC0B5591CDCC2725BF4E1BDEA"
          ProductName="Microsoft .NET Framework 4.7"
          Size="1426720"
          Version="4.7.2053.0" />
      </ExePackage>
    </PackageGroup>
  </Fragment>

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

    <WixVariable Id="WixMbaPrereqPackageId" Value="NetFx47Redist" />
    <WixVariable Id="WixMbaPrereqLicenseUrl" Value="$(var.NetFx47EulaLink)" Overridable="yes" />
    <WixVariable Id="NetFx47RedistDetectCondition" Value="NETFRAMEWORK45 &gt;= $(var.NetFx47MinRelease)" Overridable="yes" />
    <WixVariable Id="NetFx47RedistInstallCondition" Value="" Overridable="yes" />
    <WixVariable Id="NetFx47RedistPackageDirectory" Value="redist\" Overridable="yes" />

    <PackageGroup Id="NetFx47Redist">
      <ExePackage
          InstallCommand="/q /norestart /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx47FullLog].html&quot;"
          RepairCommand="/q /norestart /repair /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx47FullLog].html&quot;"
          UninstallCommand="/uninstall /q /norestart /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx47FullLog].html&quot;"
          PerMachine="yes"
          DetectCondition="!(wix.NetFx47RedistDetectCondition)"
          InstallCondition="!(wix.NetFx47RedistInstallCondition)"
          Id="NetFx47Redist"
          Vital="yes"
          Permanent="yes"
          Protocol="netfx4"
          DownloadUrl="$(var.NetFx47RedistLink)"
          LogPathVariable="NetFx47FullLog"
          Compressed="no"
          Name="!(wix.NetFx47RedistPackageDirectory)NDP47-KB3186497-x86-x64-AllOS-ENU.exe">
        <RemotePayload
          CertificatePublicKey="371DD003A37769487A2A89A5A9DDB3026451B906"
          CertificateThumbprint="98ED99A67886D020C564923B7DF25E9AC019DF26"
          Description="Microsoft .NET Framework 4.7 Setup"
          Hash="76054141A492BA307595250BDA05AD4E0694CDC3"
          ProductName="Microsoft .NET Framework 4.7"
          Size="61586744"
          Version="4.7.2053.0" />
      </ExePackage>
    </PackageGroup>
  </Fragment>
</Wix>
<Chain>            
      <PackageGroupRef Id="NetFx47Redist"/>
</Chain>
Smurf-IV commented 7 years ago

Until support comes from the extension i.e. <PropertyRef Id="WIX_IS_NETFRAMEWORK_47_OR_LATER_INSTALLED" />

Then I am doing this <PropertyRef Id="NETFRAMEWORK45" /> <Condition Message="[ProductName] Requires .NET Framework 4.7 or later to be installed"> <![CDATA[Installed OR (NETFRAMEWORK45 AND NETFRAMEWORK45 >= "#460805")]]> </Condition>

With the following to notify me when the extension changes so that I can use the documented type. <Property Id="WIX_IS_NETFRAMEWORK_47_OR_LATER_INSTALLED" Value="0" />

Mawe9999 commented 7 years ago

Thanks Smurf-IV for pointing that out, I forgot to change the NetFx47MinRelease variable. I've edited the code above.

The correct value for NetFx47MinRelease is 460798 https://msdn.microsoft.com/en-us/library/hh925568(v=vs.110).aspx

fiwonxg commented 7 years ago

@Mawe9999 the web download is broken - the redirect links point to the webpages instead of executables, so the download fails.

fiwonxg commented 7 years ago

Looks like instead of http://go.microsoft.com/fwlink/?LinkId=825299 http://go.microsoft.com/fwlink/?LinkId=825303

it should be http://go.microsoft.com/fwlink/?LinkId=825298 http://go.microsoft.com/fwlink/?LinkId=825302

Mawe9999 commented 7 years ago

You are right. I've edited the code above.

wstaelens commented 7 years ago

yeah waiting for this!

todor-dk commented 7 years ago

Please, give this issue a priority. Alternatively, write a work-around article on what to do in the meantime.

Mawe9999 commented 7 years ago

Just use the code I've posted above. Add a new wxs file to your setup project and copy & paste the code.

todor-dk commented 7 years ago

Thank you. I didn't know that a project could contain several WXS files.

todor-dk commented 7 years ago

It works ... mostly. The .Net 4.7 requires some updates on Win 7 and 8 to be present before it will install (http://go.microsoft.com/fwlink/?LinkId=724315). If they are missing, the installer fails with a cryptic error. Digging in log files and trying to install manually, you will find the message: Blocking Issues: Setup cannot continue because a dependent update needs to be installed before you can install this product on Windows 7, Windows Server 2008 R2, Windows 8 or Windows Server 2012.

Is it possible to include those prerequisites so that NetFx47Web will install them automatically?

Alternatively, would you define a standard condition that checks for the .Net 4.7 prerequisites and that will prevent the installer from running until "this and that" has been installed?

Optionally, it is possible to report the problem from the underlying .Net package to the bootstrapper app, so that the end-user has a chance to install the prerequisites and fix the problem?

Mawe9999 commented 7 years ago

You could add those prerequisites to your bootstrapper, but I'm not sure how to detect whether the KB is installed or not.

todor-dk commented 7 years ago

OK. I will look into this. Do you know if there is a way to communicate the error messages from the MSI package to the bootstrapper app? In this way, we can tell the user what's wrong. We have our own bootstrapper app that we can customize.

softlion commented 7 years ago

Info for missing update: d3dcompiler

https://support.microsoft.com/fr-fr/help/4020302/the-net-framework-4-7-installation-is-blocked-on-windows-7-windows-ser

For: On Windows 7 SP1 x86 On Windows 7 SP1 or Windows Server 2008 R2 x64 On Windows Server 2012 x64

I've implemented this in a PackageGroup where NetFx47Web is installed (note: the conditions are not working):

  <MsuPackage
    Id="d3dcompiler64"
    Compressed="no"
    DetectCondition="((NOT VersionNT64) OR (VersionNT > v6.1))"
    DownloadUrl="http://go.microsoft.com/fwlink/?LinkId=848158"
    KB="KB4019990"
    Name="redist\Windows6.1-KB4019990-x64.msu">
    <RemotePayload CertificatePublicKey="371DD003A37769487A2A89A5A9DDB3026451B906" CertificateThumbprint="98ED99A67886D020C564923B7DF25E9AC019DF26" Description="Microsoft .NET Framework 4.7 prerequisite setup" Hash="35CC310E81EF23439BA0EC1F11D7B71DD34ADFE5" ProductName="Microsoft .NET Framework 4.7 prerequisite" Size="2873529" Version="1.0.0.0" />
  </MsuPackage>

  <!-- Windows 7 SP1 x86 -->
  <MsuPackage
    Id="d3dcompiler86"
    Compressed="no"
    DetectCondition="((VersionNT64) OR (VersionNT > v6.1))"
    DownloadUrl="http://go.microsoft.com/fwlink/?LinkId=848159"
    KB="KB4019990"
    Name="redist\Windows6.1-KB4019990-x86.msu">
    <RemotePayload CertificatePublicKey="371DD003A37769487A2A89A5A9DDB3026451B906" CertificateThumbprint="98ED99A67886D020C564923B7DF25E9AC019DF26" Description="Microsoft .NET Framework 4.7 prerequisite setup" Hash="1365FB557D5E5917CBF59B507EAC066AD89EA3F7" ProductName="Microsoft .NET Framework 4.7 prerequisite" Size="1424481" Version="1.0.0.0" />
  </MsuPackage>
KirilRusev commented 6 years ago

We need standard support for .NET Framework 4.7.1

Mawe9999 commented 6 years ago

Use this for .Net 4.7.1 Support. Add a new wxs file to your bootstrapper and copy the code below.

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

Usage:

<Chain>      
      <PackageGroupRef Id="NetFx471Redist"/>
</Chain>
KirilRusev commented 6 years ago

Hi @Mawe9999 , thank you. I've added the first part of the code in separate NetFx471Redist.wxs file, but when I try to reference it in my Product.wxs I get "Unresolved reference to symbol 'Property:NetFx471Redist' in section 'Product:*'." like:

<PropertyRef Id="NetFx471Redist"/>
<Condition Message="You must install Microsoft .NET Framework 4.7.1 or higher.">
  <![CDATA[Installed OR NetFx471Redist]]>
</Condition>

Any idea why? Both wxs start with <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" ...

Mawe9999 commented 6 years ago

@KirilRusev Did you create a bootstrapper project?

Your bundle.wxs should be something like 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>

You might want to check out the documentation on how to create bundles: http://wixtoolset.org/documentation/manual/v3/bundle/

cogwheel commented 6 years ago

@Mawe9999 How is this new wxs file supposed to be referenced? Does it need to be added to the build script? Is just having the wxs file in the dir supposed to work?

Mawe9999 commented 6 years ago

@cogwheel If you are working with Visual Studio you can add the wxs file to your bootstrapper project and it should work without being referenced anywhere.

cogwheel commented 6 years ago

I joined a project that is using the command line Wix tools without a bootstrapper, so it wasn't that simple. I managed to figure it out though: just had to add the netfx471.wxs to the same candle & light commands as the bundle.wxs that I added.

iswix-llc commented 6 years ago

I haven't come across the missing dependency blocking the 4.7.1 install but I have been seeing a situation where burn thinks 4.7.1 failed but the netfx log says it just needs a reboot. Everything works after the reboot but the error message saying the bundle was failed to rollback looks bad to the user.

Mawe9999 commented 6 years ago

If someone needs WIX support for .Net 4.7.2 use the following code.

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

  <?define NetFx472MinRelease = 461808 ?>
  <?define NetFx472WebLink = http://go.microsoft.com/fwlink/?LinkId=863262 ?>
  <?define NetFx472RedistLink = http://go.microsoft.com/fwlink/?LinkId=863265 ?>
  <?define NetFx472EulaLink = http://referencesource.microsoft.com/license.html ?>

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

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

    <WixVariable Id="WixMbaPrereqPackageId" Value="NetFx472Web" />
    <WixVariable Id="WixMbaPrereqLicenseUrl" Value="$(var.NetFx472EulaLink)" Overridable="yes" />
    <WixVariable Id="NetFx472WebDetectCondition" Value="NETFRAMEWORK45 &gt;= $(var.NetFx472MinRelease)" Overridable="yes" />
    <WixVariable Id="NetFx472WebInstallCondition" Value="" Overridable="yes" />
    <WixVariable Id="NetFx472WebPackageDirectory" Value="redist\" Overridable="yes" />

    <PackageGroup Id="NetFx472Web">
      <ExePackage
          InstallCommand="/q /norestart /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx472FullLog].html&quot;"
          RepairCommand="/q /norestart /repair /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx472FullLog].html&quot;"
          UninstallCommand="/uninstall /q /norestart /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx472FullLog].html&quot;"
          PerMachine="yes"
          DetectCondition="!(wix.NetFx472WebDetectCondition)"
          InstallCondition="!(wix.NetFx472WebInstallCondition)"
          Id="NetFx472Web"
          Vital="yes"
          Permanent="yes"
          Protocol="netfx4"
          DownloadUrl="$(var.NetFx472WebLink)"
          LogPathVariable="NetFx472FullLog"
          Compressed="no"
          Name="!(wix.NetFx472WebPackageDirectory)NDP472-KB4054531-Web.exe">
        <RemotePayload
          CertificatePublicKey="C090C1A2CAFA9B967D9C87C7FE02F7C01FBDE4F2"
          CertificateThumbprint="5EAD300DC7E4D637948ECB0ED829A072BD152E17"
          Description="Microsoft .NET Framework 4.7.2 Setup"
          Hash="507ECDADC23A27C2283BA130A2AA51650E6BC05B"
          ProductName="Microsoft .NET Framework 4.7.2"
          Size="1447320"
          Version="4.7.3062.0" />
      </ExePackage>
    </PackageGroup>
  </Fragment>

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

    <WixVariable Id="WixMbaPrereqPackageId" Value="NetFx472Redist" />
    <WixVariable Id="WixMbaPrereqLicenseUrl" Value="$(var.NetFx472EulaLink)" Overridable="yes" />
    <WixVariable Id="NetFx472RedistDetectCondition" Value="NETFRAMEWORK45 &gt;= $(var.NetFx472MinRelease)" Overridable="yes" />
    <WixVariable Id="NetFx472RedistInstallCondition" Value="" Overridable="yes" />
    <WixVariable Id="NetFx472RedistPackageDirectory" Value="redist\" Overridable="yes" />

    <PackageGroup Id="NetFx472Redist">
      <ExePackage
          InstallCommand="/q /norestart /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx472FullLog].html&quot;"
          RepairCommand="/q /norestart /repair /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx472FullLog].html&quot;"
          UninstallCommand="/uninstall /q /norestart /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx472FullLog].html&quot;"
          PerMachine="yes"
          DetectCondition="!(wix.NetFx472RedistDetectCondition)"
          InstallCondition="!(wix.NetFx472RedistInstallCondition)"
          Id="NetFx472Redist"
          Vital="yes"
          Permanent="yes"
          Protocol="netfx4"
          DownloadUrl="$(var.NetFx472RedistLink)"
          LogPathVariable="NetFx472FullLog"
          Compressed="no"
          Name="!(wix.NetFx472RedistPackageDirectory)NDP472-KB4054530-x86-x64-AllOS-ENU.exe">
        <RemotePayload
          CertificatePublicKey="C090C1A2CAFA9B967D9C87C7FE02F7C01FBDE4F2"
          CertificateThumbprint="5EAD300DC7E4D637948ECB0ED829A072BD152E17"
          Description="Microsoft .NET Framework 4.7.2 Setup"
          Hash="D3A416DC5FC75758D41B4C0158ACA69270D2A904"
          ProductName="Microsoft .NET Framework 4.7.2"
          Size="71607232"
          Version="4.7.3062.0" />
      </ExePackage>
    </PackageGroup>
  </Fragment>
</Wix>

Add the following code to your bundle

<Chain>
  <!--Install .Net Framework 4.7.2-->
  <PackageGroupRef Id="NetFx472Redist"/>
</Chain>
dgxhubbard commented 6 years ago

Thanks @Mawe9999 for the 4.7.2 update

InkUisitor commented 6 years ago

Thanks @Mawe9999 !

henning-krause commented 6 years ago

The links in the sample from @Mawe9999 should be changed to https. Otherwise an installer might fail when run on a Windows Server with the Enhanced Security configuration enabled.

Spocher commented 6 years ago

Please Help! In code @Mawe9999 on Build i get error: Unresolved reference to symbol 'WixSearch:NETFRAMEWORK45' in section 'Fragment:'

Solved: I'm forgot add reference to WixNetFxExtension in Bootstrapper

Spocher commented 6 years ago

Tell me somebody how include vc_redist in Bootstrapper

robmen commented 6 years ago

@Spocher, for support please contact the wix-users mailing list.

CiraciNicolo commented 5 years ago

Can someone provide me some info on how can I use this in a Product enviroment?

Spocher commented 5 years ago

Can someone provide me some info on how can I use this in a Product enviroment?

Yes, ask, I did it

CiraciNicolo commented 5 years ago

Yes, ask, I did it

I was able to use this with a Product setup, but I need to reboot the machine after .Net is installed and this fails the boostrap installer (the msi installed after .NET contains a Service that needs .NET). Is there a workaround? Or a UI that tells "please reboot your machine and restart the exe"?

Spocher commented 5 years ago

Yes, ask, I did it

I was able to use this with a Product setup, but I need to reboot the machine after .Net is installed and this fails the boostrap installer (the msi installed after .NET contains a Service that needs .NET). Is there a workaround? Or a UI that tells "please reboot your machine and restart the exe"?

Reboot was not required in my case. But I think that about such an action as restarting the computer you need to warn the user. And better let he himself its produces.

theCorb1nator commented 5 years ago

How can i just display a message to the user if Net472 is not installed?, i do not want to bundle the framework installer with the MSI but just check if its installed on the machine and alert the user if not

Mawe9999 commented 5 years ago

@theCorb1nator

You can use the Property WIX_IS_NETFRAMEWORK_472_OR_LATER_INSTALLED to check if .NET 4.7.2 is installed without using a bundle installer. Make sure to include the fragment I've posted above to your msi project.

Than add the following to your Product.wxs:

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

    <PropertyRef Id="WIX_IS_NETFRAMEWORK_472_OR_LATER_INSTALLED"/>

    <Condition Message="This application requires .NET Framework 4.7.2. Please install the .NET Framework then run this installer again.">
      <![CDATA[WIX_IS_NETFRAMEWORK_472_OR_LATER_INSTALLED]]>
    </Condition>

    ...

  </Product>
</Wix>
theCorb1nator commented 5 years ago

@theCorb1nator

You can use the Property WIX_IS_NETFRAMEWORK_472_OR_LATER_INSTALLED to check if .NET 4.7.2 is installed without using a bundle installer. Make sure to include the fragment I've posted above to your msi project.

Than add the following to your Product.wxs:

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

    <PropertyRef Id="WIX_IS_NETFRAMEWORK_472_OR_LATER_INSTALLED"/>

    <Condition Message="This application requires .NET Framework 4.7.2. Please install the .NET Framework then run this installer again.">
      <![CDATA[WIX_IS_NETFRAMEWORK_472_OR_LATER_INSTALLED]]>
    </Condition>

    ...

  </Product>
</Wix>

Thanks for the reply,

Do you mean just this Fragment

<Fragment>
    <PropertyRef Id="WIXNETFX4RELEASEINSTALLED" />
    <Property Id="WIX_IS_NETFRAMEWORK_472_OR_LATER_INSTALLED" Secure="yes" />
    <SetProperty Id="WIX_IS_NETFRAMEWORK_472_OR_LATER_INSTALLED" Value="1" After="AppSearch">
      WIXNETFX4RELEASEINSTALLED >= "#$(var.NetFx472MinRelease)"
    </SetProperty>
  </Fragment>
Mawe9999 commented 5 years ago

Do you mean just this Fragment

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

yes that fragment, and additionally the NetFx472MinRelease Definition

<?define NetFx472MinRelease = 461808 ?>

You also need to add a Reference to the WixNetFxExtension.dll (found in the WiX Installation folder)

best regards

jol64 commented 5 years ago

I tried https://github.com/wixtoolset/issues/issues/5575#issuecomment-386223409 (only changing to https), and while it works on a Windows 8.1 64bit, it fails on Windows 7 32bit (German if that matters). window 7 32bit german issue.zip Any idea why? Thanks, Joachim

BMurri commented 5 years ago

@jol64 your installation failed due to a known issue with that win7 machine not having a required security certificate update installed from Microsoft. I'm working on an update that will hopefully include this, if I can find a good way to detect it.

jol64 commented 5 years ago

@jol64 your installation failed due to a known issue with that win7 machine not having a required security certificate update installed from Microsoft. I'm working on an update that will hopefully include this, if I can find a good way to detect it.

interesting. I succeeded on a Windows 7 64bit and was concluding the issue is 32bits. Thanks for the update anyway. Is there a (manual) update I can suggest to users?

icodev-space commented 5 years ago

@Mawe9999 Property reference to WIXNETFX4RELEASEINSTALLED errors if the installer is build from command line. Reference to NetFxExtention.dll is added to the project; xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension"; and -ext WixNetFxExtension.dll to both candle.exe and light.exe, any clues?

To add to the above, the build machine is using wix 3.7 where locally I have no problems building with 3.11, could that be the problem?

BMurri commented 5 years ago

@stKris that property was added in v3.8 with support for installing Net v4.5, so yes, that would be your problem.

Euphoric commented 5 years ago

I find these changes not much helpful if I want to have .NET installer embedded in the final installer. I still need to define my own package with parameters that force it to include the installer binary.

It should be possible to extend these changes with something like this :

    <PackageGroup Id="NetFx472RedistEmbedded">
      <ExePackage
        InstallCommand="/q /norestart /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx472FullLog].html&quot;"
        RepairCommand="/q /norestart /repair /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx472FullLog].html&quot;"
        UninstallCommand="/uninstall /q /norestart /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx472FullLog].html&quot;"
        PerMachine="yes"
        DetectCondition="!(wix.NetFx472RedistDetectCondition)"
        InstallCondition="!(wix.NetFx472RedistInstallCondition)"
        Id="NetFx472Redist"
        Vital="yes"
        Permanent="yes"
        Protocol="netfx4"
        LogPathVariable="NetFx472FullLog"
        Compressed="yes"
        Name="!(wix.NetFx472RedistPackageDirectory)NDP472-KB4054530-x86-x64-AllOS-ENU.exe">
      </ExePackage>
    </PackageGroup>

This is same as in this thread, but with the Download sections removed and Compressed set to yes.

jol64 commented 5 years ago

I find these changes not much helpful if I want to have .NET installer embedded in the final installer. I still need to define my own package with parameters that force it to include the installer binary.

I guess it depends on how you want to distribute. If you offer a download from the web, why should you include .NET and waste bandwidth on something that likely is already installed on many target PCs. And which version would you include? The oldest you run with? Force updates?

brentdooley commented 4 years ago

Hi jol64, I am looking for an Embedded solution because I need to create a distribution that is installed on computers without access to the internet. I am going to test Euphoric's solution.

wstaelens commented 4 years ago

@theCorb1nator You can use the Property WIX_IS_NETFRAMEWORK_472_OR_LATER_INSTALLED to check if .NET 4.7.2 is installed without using a bundle installer. Make sure to include the fragment I've posted above to your msi project. Than add the following to your Product.wxs:

...

does not work here: "Unrsolved reference to symbol 'Property:WIX_IS_NETFRAMEWORK_472_OR_LATER_INSTALLED' in section 'Product:*'.

I have a project "WixBootstrapper" where the NetFx472Redist.wxs exists.

any suggestions?

gabiganam commented 4 years ago

Hi, I'm trying to use @Mawe9999 code to install .NET 4.7.2 with my bundle, and while the project compiles properly, I'm getting the following failures in run time: [00A4:1478][2020-01-19T16:14:57]i201: Planned package: NetFx472Redist, state: Absent, default requested: Present, ba requested: Present, execute: Install, rollback: None, cache: Yes, uncache: No, dependency: None ... [00A4:0608][2020-01-19T16:14:57]w343: Prompt for source of package: NetFx472Redist, payload: NetFx472Redist, path: C:\Users\administrator\Downloads\redist\NDP472-KB4054530-x86-x64-AllOS-ENU.exe [00A4:0608][2020-01-19T16:14:57]e054: Failed to resolve source for file: C:\Users\administrator\Downloads\redist\NDP472-KB4054530-x86-x64-AllOS-ENU.exe, error: 0x80070002. [00A4:0608][2020-01-19T16:14:57]e000: Error 0x80070002: Failed while prompting for source (original path 'C:\Users\administrator\Downloads\redist\NDP472-KB4054530-x86-x64-AllOS-ENU.exe'). [00A4:0608][2020-01-19T16:14:57]e313: Failed to acquire payload: NetFx472Redist to working path: C:\Windows\Temp{F1DB101B-38A9-4C01-AA3F-B36D7F7D019B}\NetFx472Redist, error: 0x80070002. [00A4:1478][2020-01-19T16:14:57]e000: Error 0x80070002: Cache thread exited unexpectedly.

Seems like the bundle installer fails because it can't find the .NET installer, which makes sense because it's not there. Why doesn't the bundle installer download it?

elachlan commented 4 years ago

Can anyone explain why the associated PR hasn't been merged and why there hasn't been a release to fix this? The last release of Wix3 was in September 2019. This issue was opened in May of 2017! This is needed as much as visual studio support.

rseanhall commented 4 years ago

It was put into the 4.x milestone when the team did triage in May 2017. v3.14 has a very high bar and this didn't meet it. It's still open because it needs to be done in the new v4 NetFx.wixext repository. By the way, it looks like the friendly people of FireGiant have some new ones in their repo - https://github.com/firegiant/wix3/tree/develop/src/ext/NetFxExtension/wixlib. All you have to do is copy the file you need into your project.

elachlan commented 4 years ago

@rseanhall I really appreciate your fast response and appreciate all the teams efforts. Thanks!