wixtoolset / issues

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

NetFxExtension should support .net 4.8 #5977

Closed Smurf-IV closed 4 years ago

Smurf-IV commented 5 years ago

What numbers should be used to allow the detection of .Net 4.8.0 ? Related to #5575 https://github.com/Microsoft/dotnet-framework-early-access

Smurf-IV commented 5 years ago

This seems to work for the Current (RC) of .Net 4.8


<?define NetFx480MinRelease = 528033 ?>

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

<Condition Message="[ProductName] Requires .NET Framework 4.8.0 or later to be installed. Please install from the `Pre-Reqs` folder.">
   <![CDATA[Installed OR WIX_IS_NETFRAMEWORK_480_OR_LATER_INSTALLED]]>
</Condition>
chrpai commented 5 years ago

I know the focus is on 4.0 but it'd be really nice if 3.14 contained fixes to the NetFx and VS extensions to catch up on this technical debt. Committed to 4.0 first of course. ;)

BMurri commented 5 years ago

I'm actually working on this for both v3.14 & v4

Mawe9999 commented 5 years ago

You can use version number 528040 to detect the .NET 4.8 Framework according to: https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed

Here is my .NET 4.8 installer implementation, If someone need it:

<?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 &gt;= $(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 &quot;[WixBundleName]&quot; /log &quot;[NetFx48FullLog].html&quot;"
          RepairCommand="/q /norestart /repair /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx48FullLog].html&quot;"
          UninstallCommand="/uninstall /q /norestart /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx48FullLog].html&quot;"
          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="793980B0038EBF0A88DAA08420FD3E66F53CC0CE"
          CertificateThumbprint="9DC17888B5CFAD98B3CB35C1994E96227F061675"
          Description="Microsoft .NET Framework 4.8 Setup"
          Hash="755349ECD6A478FE010E466B29911D2388F6CE94"
          ProductName="Microsoft .NET Framework 4.8"
          Size="1486376"
          Version="4.8.3761.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 &gt;= $(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 &quot;[WixBundleName]&quot; /log &quot;[NetFx48FullLog].html&quot;"
          RepairCommand="/q /norestart /repair /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx48FullLog].html&quot;"
          UninstallCommand="/uninstall /q /norestart /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx48FullLog].html&quot;"
          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="793980B0038EBF0A88DAA08420FD3E66F53CC0CE"
          CertificateThumbprint="9DC17888B5CFAD98B3CB35C1994E96227F061675"
          Description="Microsoft .NET Framework 4.8 Setup"
          Hash="0D425249D42A01E7AB3AC243152FA7773C43F0BF"
          ProductName="Microsoft .NET Framework 4.8"
          Size="72721568"
          Version="4.8.3761.0" />
      </ExePackage>
    </PackageGroup>
  </Fragment>
</Wix>

Usage: Add a Reference to "WixNetFxExtension.dll" and include this code into your MSI or Bundle Project

Usage in bundle:

<Bundle ...>
   <Chain>
      <!--Install .Net Framework 4.8-->
      <PackageGroupRef Id="NetFx48Redist"/>                     
   </Chain>
</Bundle>

Usage in MSI:

<Product ...>
   <!-- Abort installation if the .NET Framework 4.8 is not installed -->
   <Condition Message="This application requires .NET Framework 4.8. Please install the .NET Framework then run this installer again.">
      <![CDATA[Installed OR WIX_IS_NETFRAMEWORK_48_OR_LATER_INSTALLED]]>
   </Condition> 
</Product>
manison commented 5 years ago

Microsoft apparently updated .NET 4.8 installers in the meantime and the above fragment no longer works since the verification of the remote payload fails. Updated remote payloads are currently as follows:

<PackageGroup Id="NetFx48Web">
  <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" />
</PackageGroup>
<PackageGroup Id="NetFx48Redist">
  <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" />
</PackageGroup>

Tip: You can get actual values using heat payload <payload> -o payload.wxs. (Thanks to https://stackoverflow.com/questions/12480408/how-to-find-wix-remotepayloads-certificatepublickey-hash.)

ghost commented 4 years ago

4.8 is not supported in 3.11.+ ?? Is there a way for me to get this going ??

robmen commented 4 years ago

Absolutely supported. You just have to author the RemotePayload and RegistrySearch yourself.

Xenobyte1 commented 4 years ago

If you just want to check for the existence in Prooduct.wxs.

<Condition Message ="This Product requires Microsoft .Net version 4.8 or higher."> MsiNetAssemblySupport >= "4.8.03752" </Condition>

GuidoCantalupo commented 4 years ago

I'm getting the following error : error LGHT0094 : Unresolved reference to symbol 'ChainPackageGroup:NetFx48Redist' in section 'Bundle I'm working on a setup project which installs my product. Also I have a bootstrapper.wxs that generate a bundle with my product msi and other pre-requisites. This issue happend when try to insert the NetFx48Redist packageGroupRef into my chain. I guess that some reference could be missing but don't know how to fix it. Does anyone know ? Thanks !

glen-nicol commented 4 years ago

Hi there, I am using the fragments listed above to install 4.8. They work great on version of Windows that support 4.8, but on the ones that don't (base Windows 7, 8, and first two versions of 10) you get cryptic errors like the one below.

image

Is there a way to add extra checks to get around the weird errors produced by the .net installer or the protocol that communicates with it in burn?

I was thinking of adding MSI conditions with messages for those windows versions but since there is so much special handling with the .net framework i figured it would be better to ask first.

rseanhall commented 4 years ago

@glen-nicol The WiX Toolset does not use GitHub issues for support. Please ask your question on the wix-users mailing list or Stack Overflow.

glen-nicol commented 4 years ago

Right. Sorry about that.

JeffGrewer commented 4 years ago

"It's supported except you have to write it yourself". Yuck.

robmen commented 4 years ago

Or, @JeffGrewer , you could join us on the wix-devs mailing list, propose a solution, integrate feedback then develop the solution that can be used by everyone... or you could encourage someone else to do the work for you.

But please do realize that the comment you left discourages someone who does contribute extensively to the project from tackling this problem in their free time. #osshs

rseanhall commented 4 years ago

I don't understand? I already implemented this in https://github.com/wixtoolset/wix3/pull/520. The only question now is why hasn't it been merged?

BMurri commented 4 years ago

The error @glen-nicol is seeing may be caused by a missing KB4019990 on the box. That is a prerequisite for all the most recent .NET Framework installers.

JeffGrewer commented 4 years ago

@robmen You're right. Sorry about that.

wstaelens commented 3 years ago

Absolutely supported. You just have to author the RemotePayload and RegistrySearch yourself.

example code?

Why is there such a gap between 3.11 and 3.14 release? as still I can't get .net 4.8 check working on 3.11 ...

JVimes commented 3 years ago

@wstaelens I wonder if the change is in a preview release or something, since @rseanhall's pull request got merged. If not, what I did was download NetFx48.wxs and added its path to my candle.exe arguments. Then I was able to check for .NET like before but with "48" instead of "462" in various places. I hope I'm remembering that correctly.

wstaelens commented 3 years ago

Solved it nu going to V3.14.

Could not get it working in v3.11 after 2 hours and several builds and modifications.

jamsoft commented 3 years ago

Where on earth did you get 3.14?

https://wixtoolset.org/releases/ only points to 3.11.2

cremor commented 3 years ago

It's linked under "development builds" on the site you linked.

jamsoft commented 3 years ago

Slaps forehead ...

I just read that it's not intended for long-term use, more a stepping stone to v4 when it arrives. Hmm ... I just need the 4.8 check.

swhitecar commented 3 years ago

If I tried using the NetFx48.wxs and with V3.11 and it just seems to do weird stuff. Seems like it maybe doesn't understand the protocol="netfx4" and can't pick up on what the redist package is doing. I gave up and let the redist package display its own GUI and allow users to close programs and force a reboot if they don't. Modified as shown below.

    <PackageGroup Id="NetFx48Redist">
        <ExePackage
            InstallCommand="/passive /norestart /showrmui /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx48RedistLog].html&quot;"
            RepairCommand="/passive /norestart /showrmui /repair /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx48RedistLog].html&quot;"
            UninstallCommand="/uninstall /passive /showrmui /norestart /ChainingPackage &quot;[WixBundleName]&quot; /log &quot;[NetFx48RedistLog].html&quot;"
            PerMachine="yes"
            DetectCondition="!(wix.NetFx48RedistDetectCondition)"
            InstallCondition="!(wix.NetFx48RedistInstallCondition)"
            Id="NetFx48Redist"
            Vital="yes"
            Permanent="yes"
            DownloadUrl="$(var.NetFx48RedistLink)"
            LogPathVariable="NetFx48RedistLog"
            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" />
            <ExitCode Value="1641" Behavior="forceReboot"/>
            <ExitCode Value="3010" Behavior="forceReboot"/>
            <ExitCode Value="0"    Behavior="success"/>
        </ExePackage>
    </PackageGroup>
jamsoft commented 3 years ago

@swhitecar Yup. I'm seeing all kinds of weirdness too.

One time It decided to do the install of 4.8. it looked like it had completed, then my installer was locked in a loop of trying to install it again.

Or I see the dreaded Note: 1: 2203 2: Setup.exe 3: -2147286960 and MainEngineThread is returning 1620

Both notoriously hard to diagnose apparently. Will try yours now. Thanks.

jamsoft commented 3 years ago

@swhitecar I just tried your PackageGroup on a Vanilla Win 7 SP1 VM and it's not working. Haven't tried in a Win 8 or 10 box yet.

rseanhall commented 3 years ago

Please move this discussion to a Discussion - https://github.com/wixtoolset/issues/discussions. This is resolved. Thanks.