Add NetFx 4.8.1 detection and package groups.
Fixes https://github.com/wixtoolset/issues/issues/7239.
Bob Arnson committed
Feb 27, 2023 at 21:38 UTC
696880ef8e3125b4f508b8c10a6728321323c6b4
3 files changed
+154
src/ext/NetFx/test/WixToolsetTest.Netfx/NetfxExtensionFixture.cs
+32
@@ -76,6 +76,38 @@ namespace WixToolsetTest.Netfx
76
}
77
}
78
79
+ [Fact]
80
+ public void CanBuildUsingNetFx481Packages()
81
+ {
82
+ using (var fs = new DisposableFileSystem())
83
+ {
84
+ var baseFolder = fs.GetFolder();
85
+ var bundleFile = Path.Combine(baseFolder, "bin", "test.exe");
86
+ var bundleSourceFolder = TestData.Get(@"TestData\UsingNetFxPackages");
87
+ var intermediateFolder = Path.Combine(baseFolder, "obj");
88
+
89
+ var extensionResult = WixRunner.Execute(new[]
90
+ {
91
+ "extension", "add",
92
+ "WixToolset.Bal.wixext"
93
+ });
94
+
95
+ var compileResult = WixRunner.Execute(new[]
96
+ {
97
+ "build",
98
+ Path.Combine(bundleSourceFolder, "BundleLatest.wxs"),
99
+ "-ext", "WixToolset.Bal.wixext",
100
+ "-ext", TestData.Get(@"WixToolset.Netfx.wixext.dll"),
101
+ "-intermediateFolder", intermediateFolder,
102
+ "-o", bundleFile,
103
+ "-arch", "x64",
104
+ });
105
+ compileResult.AssertSuccess();
106
+
107
+ Assert.True(File.Exists(bundleFile));
108
+ }
109
+ }
110
+
111
[Fact]
112
public void CanBuildUsingNativeImage()
113
{
src/ext/NetFx/test/WixToolsetTest.Netfx/TestData/UsingNetFxPackages/BundleLatest.wxs
new
+11
@@ -0,0 +1,11 @@
1
+<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal">
2
+ <Bundle Name="NetFxPackageGroup481" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="{1A204524-03F4-4641-BDF3-2A272A34A888}">
3
+ <BootstrapperApplication>
4
+ <bal:WixStandardBootstrapperApplication LicenseUrl="http://wixtoolset.org/about/license/" Theme="hyperlinkLicense" />
5
+ </BootstrapperApplication>
6
+
7
+ <Chain>
8
+ <PackageGroupRef Id="NetFx481RedistAsPrereq" />
9
+ </Chain>
10
+ </Bundle>
11
+</Wix>
src/ext/NetFx/wixlib/NetFx481.wxs
new
+111
@@ -0,0 +1,111 @@
1
+<!-- 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. -->
2
+
3
+<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
4
+
5
+ <!--
6
+ .NET Framework installation state properties
7
+
8
+ Official documentation can be found at the following locations:
9
+ https://learn.microsoft.com/en-us/dotnet/framework/install/guide-for-developers
10
+ https://learn.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed
11
+ -->
12
+
13
+ <?define NetFx481MinRelease = 533320 ?>
14
+ <?define NetFx481WebLink = https://go.microsoft.com/fwlink/?LinkId=2203304 ?>
15
+ <?define NetFx481RedistLink = https://go.microsoft.com/fwlink/?linkid=2203305 ?>
16
+ <?define NetFx481EulaLink = https://referencesource.microsoft.com/license.html ?>
17
+ <?define NetFx481WebId = NetFx481Web ?>
18
+ <?define NetFx481RedistId = NetFx481Redist ?>
19
+
20
+ <Fragment>
21
+ <PropertyRef Id="WIXNETFX4RELEASEINSTALLED" />
22
+ <Property Id="WIX_IS_NETFRAMEWORK_481_OR_LATER_INSTALLED" Secure="yes" />
23
+ <SetProperty Id="WIX_IS_NETFRAMEWORK_481_OR_LATER_INSTALLED" Value="1" After="AppSearch" Condition="WIXNETFX4RELEASEINSTALLED >= "#$(var.NetFx481MinRelease)"" />
24
+ </Fragment>
25
+
26
+ <Fragment>
27
+ <util:RegistrySearchRef Id="NETFRAMEWORK45" />
28
+
29
+ <WixVariable Id="NetFx481WebDetectCondition" Value="NETFRAMEWORK45 >= $(var.NetFx481MinRelease)" Overridable="yes" />
30
+ <WixVariable Id="NetFx481WebInstallCondition" Value="" Overridable="yes" />
31
+ <WixVariable Id="NetFx481WebPackageDirectory" Value="redist\" Overridable="yes" />
32
+
33
+ <PackageGroup Id="$(var.NetFx481WebId)">
34
+ <ExePackage
35
+ CacheId="$(var.NetFx481WebId)_AFBF0B8B6A18F7E23CCA1DDCD0AC1A55B4035173"
36
+ InstallArguments="/q /norestart /log "[NetFx481WebLog].html""
37
+ PerMachine="yes"
38
+ DetectCondition="!(wix.NetFx481WebDetectCondition)"
39
+ InstallCondition="!(wix.NetFx481WebInstallCondition)"
40
+ Id="$(var.NetFx481WebId)"
41
+ Vital="yes"
42
+ Permanent="yes"
43
+ Protocol="netfx4"
44
+ LogPathVariable="NetFx481WebLog"
45
+ Cache="remove">
46
+
47
+ <ExePackagePayload
48
+ Name="!(wix.NetFx481WebPackageDirectory)ndp481-web.exe"
49
+ DownloadUrl="$(var.NetFx481WebLink)"
50
+ ProductName="Microsoft .NET Framework 4.8.1"
51
+ Description="Microsoft .NET Framework 4.8.1 Setup"
52
+ CertificatePublicKey="0A7D1EFF01D4EBAD21E85C51499576EBAA40E676"
53
+ CertificateThumbprint="AFBF0B8B6A18F7E23CCA1DDCD0AC1A55B4035173"
54
+ Size="1460448"
55
+ Version="4.8.09037.06"
56
+ />
57
+ </ExePackage>
58
+ </PackageGroup>
59
+ </Fragment>
60
+
61
+ <Fragment>
62
+ <PackageGroup Id="$(var.NetFx481WebId)AsPrereq">
63
+ <PackageGroupRef Id="$(var.NetFx481WebId)" />
64
+ </PackageGroup>
65
+
66
+ <bal:ManagedBootstrapperApplicationPrereqInformation PackageId="$(var.NetFx481WebId)" LicenseUrl="$(var.NetFx481EulaLink)" />
67
+ </Fragment>
68
+
69
+ <Fragment>
70
+ <util:RegistrySearchRef Id="NETFRAMEWORK45" />
71
+
72
+ <WixVariable Id="NetFx481RedistDetectCondition" Value="NETFRAMEWORK45 >= $(var.NetFx481MinRelease)" Overridable="yes" />
73
+ <WixVariable Id="NetFx481RedistInstallCondition" Value="" Overridable="yes" />
74
+ <WixVariable Id="NetFx481RedistPackageDirectory" Value="redist\" Overridable="yes" />
75
+
76
+ <PackageGroup Id="$(var.NetFx481RedistId)">
77
+ <ExePackage
78
+ CacheId="$(var.NetFx481RedistId)_AFBF0B8B6A18F7E23CCA1DDCD0AC1A55B4035173"
79
+ InstallArguments="/q /norestart /log "[NetFx481RedistLog].html""
80
+ PerMachine="yes"
81
+ DetectCondition="!(wix.NetFx481RedistDetectCondition)"
82
+ InstallCondition="!(wix.NetFx481RedistInstallCondition)"
83
+ Id="$(var.NetFx481RedistId)"
84
+ Vital="yes"
85
+ Permanent="yes"
86
+ Protocol="netfx4"
87
+ LogPathVariable="NetFx481RedistLog"
88
+ Cache="remove">
89
+
90
+ <ExePackagePayload
91
+ Name="!(wix.NetFx481RedistPackageDirectory)ndp481-x86-x64-allos-enu.exe"
92
+ DownloadUrl="$(var.NetFx481RedistLink)"
93
+ ProductName="Microsoft .NET Framework 4.8.1"
94
+ Description="Microsoft .NET Framework 4.8.1 Setup"
95
+ CertificatePublicKey="0A7D1EFF01D4EBAD21E85C51499576EBAA40E676"
96
+ CertificateThumbprint="AFBF0B8B6A18F7E23CCA1DDCD0AC1A55B4035173"
97
+ Size="63610344"
98
+ Version="4.8.09037.06"
99
+ />
100
+ </ExePackage>
101
+ </PackageGroup>
102
+ </Fragment>
103
+
104
+ <Fragment>
105
+ <PackageGroup Id="$(var.NetFx481RedistId)AsPrereq">
106
+ <PackageGroupRef Id="$(var.NetFx481RedistId)" />
107
+ </PackageGroup>
108
+
109
+ <bal:ManagedBootstrapperApplicationPrereqInformation PackageId="$(var.NetFx481RedistId)" LicenseUrl="$(var.NetFx481EulaLink)" />
110
+ </Fragment>
111
+</Wix>