aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2022-10-06 16:37:14 -0500
committerSean Hall <r.sean.hall@gmail.com>2022-10-10 11:40:02 -0500
commit21a0685ef69e9d634600622b19ea970c6f58ef03 (patch)
tree5d37e316803f06d97d4aefd3df8ab45f3f7e7257
parent3c11c1389f67824fb1f368cedacbaf566645e56f (diff)
downloadwix-21a0685ef69e9d634600622b19ea970c6f58ef03.tar.gz
wix-21a0685ef69e9d634600622b19ea970c6f58ef03.tar.bz2
wix-21a0685ef69e9d634600622b19ea970c6f58ef03.zip
Add Netfx bundle extension and netfx:DotNetCoreSearch.
Remove built-in .NET Core packages since they update too quickly. Fixes 6257
-rw-r--r--src/ext/NetFx/NetFx.wixext.sln38
-rw-r--r--src/ext/NetFx/be/NetfxBundleExtension.cpp102
-rw-r--r--src/ext/NetFx/be/NetfxBundleExtension.h17
-rw-r--r--src/ext/NetFx/be/detectnetcore.cpp140
-rw-r--r--src/ext/NetFx/be/detectnetcore.h9
-rw-r--r--src/ext/NetFx/be/netfxbe.cpp62
-rw-r--r--src/ext/NetFx/be/netfxbe.def8
-rw-r--r--src/ext/NetFx/be/netfxbe.vcxproj77
-rw-r--r--src/ext/NetFx/be/netfxsearch.cpp149
-rw-r--r--src/ext/NetFx/be/netfxsearch.h76
-rw-r--r--src/ext/NetFx/be/precomp.cpp3
-rw-r--r--src/ext/NetFx/be/precomp.h33
-rw-r--r--src/ext/NetFx/netcoresearch/netcoresearch.cpp158
-rw-r--r--src/ext/NetFx/netcoresearch/netcoresearch.h10
-rw-r--r--src/ext/NetFx/netcoresearch/netcoresearch.vcxproj73
-rw-r--r--src/ext/NetFx/netcoresearch/packages.config9
-rw-r--r--src/ext/NetFx/netcoresearch/precomp.cpp3
-rw-r--r--src/ext/NetFx/netcoresearch/precomp.h18
-rw-r--r--src/ext/NetFx/netfx.cmd7
-rw-r--r--src/ext/NetFx/test/WixToolsetTest.Netfx/NetfxExtensionFixture.cs3
-rw-r--r--src/ext/NetFx/test/WixToolsetTest.Netfx/TestData/UsingDotNetCorePackages/BundleLatest.wxs11
-rw-r--r--src/ext/NetFx/test/WixToolsetTest.Netfx/TestData/UsingDotNetCorePackages/BundleLatest_x64.wxs8
-rw-r--r--src/ext/NetFx/test/WixToolsetTest.Netfx/TestData/UsingDotNetCorePackages/NetCore3.1.12_x64.wxs (renamed from src/ext/NetFx/wixlib/NetCore3.1.12_x64.wxs)16
-rw-r--r--src/ext/NetFx/test/WixToolsetTest.Netfx/TestData/UsingDotNetCorePackages/NetCore3.1.12_x86.wxs (renamed from src/ext/NetFx/wixlib/NetCore3.1.12_x86.wxs)16
-rw-r--r--src/ext/NetFx/test/WixToolsetTest.Netfx/TestData/UsingDotNetCorePackages/NetCore3_Platform.wxi (renamed from src/ext/NetFx/wixlib/NetCore3_Platform.wxi)36
-rw-r--r--src/ext/NetFx/wixext/NetFxCompiler.cs166
-rw-r--r--src/ext/NetFx/wixext/NetFxExtensionData.cs3
-rw-r--r--src/ext/NetFx/wixext/Symbols/NetFxNativeImageSymbol.cs23
-rw-r--r--src/ext/NetFx/wixext/Symbols/NetFxNetCoreSearchSymbol.cs77
-rw-r--r--src/ext/NetFx/wixext/Symbols/NetfxSymbolDefinitions.cs49
-rw-r--r--src/ext/NetFx/wixlib/NetCore3.1_x64.wxs22
-rw-r--r--src/ext/NetFx/wixlib/NetCore3.1_x86.wxs22
-rw-r--r--src/ext/NetFx/wixlib/NetCoreShared.wxs4
-rw-r--r--src/ext/NetFx/wixlib/NetfxBundleExtension_Platform.wxi15
-rw-r--r--src/ext/NetFx/wixlib/NetfxBundleExtension_arm64.wxs7
-rw-r--r--src/ext/NetFx/wixlib/NetfxBundleExtension_x64.wxs7
-rw-r--r--src/ext/NetFx/wixlib/NetfxBundleExtension_x86.wxs7
-rw-r--r--src/ext/NetFx/wixlib/netfx.wixproj12
-rw-r--r--src/ext/Util/be/UtilBundleExtension.cpp12
-rw-r--r--src/ext/Util/be/detectsha2support.cpp8
-rw-r--r--src/ext/Util/be/precomp.h2
-rw-r--r--src/ext/Util/be/utilbe.vcxproj1
-rw-r--r--src/ext/Util/be/utilsearch.cpp20
-rw-r--r--src/ext/Util/wixext/Symbols/UtilSymbolDefinitions.cs2
-rw-r--r--src/ext/beDecor.h (renamed from src/ext/Util/be/beDecor.h)0
-rw-r--r--src/libs/dutil/WixToolset.DUtil/inc/procutil.h3
-rw-r--r--src/libs/dutil/WixToolset.DUtil/procutil.cpp3
-rw-r--r--src/test/burn/TestData/TestBA/TestBAWixlib/NetCore6.0.9_x86.wxs58
-rw-r--r--src/test/burn/TestData/TestBA/TestBAWixlib/NetCore6_Platform.wxi49
-rw-r--r--src/test/burn/TestData/TestBA/TestBAWixlib/TestBA.wxs2
-rw-r--r--src/test/burn/TestData/TestBA/TestBAWixlib/testbawixlib.wixproj1
-rw-r--r--src/test/burn/TestData/TestBA/TestBAWixlib_x64/NetCore6.0.9_x64.wxs58
-rw-r--r--src/test/burn/TestData/TestBA/TestBAWixlib_x64/TestBA_x64.wxs2
-rw-r--r--src/test/burn/TestData/TestBA/TestBAWixlib_x64/WixBA_x64.wxs2
-rw-r--r--src/test/burn/TestData/TestBA/TestBAWixlib_x64/testbawixlib_x64.wixproj1
55 files changed, 1569 insertions, 151 deletions
diff --git a/src/ext/NetFx/NetFx.wixext.sln b/src/ext/NetFx/NetFx.wixext.sln
index 8316ac91..b8b72eb8 100644
--- a/src/ext/NetFx/NetFx.wixext.sln
+++ b/src/ext/NetFx/NetFx.wixext.sln
@@ -1,8 +1,12 @@
1 1
2Microsoft Visual Studio Solution File, Format Version 12.00 2Microsoft Visual Studio Solution File, Format Version 12.00
3# Visual Studio 15 3# Visual Studio Version 17
4VisualStudioVersion = 15.0.27130.2010 4VisualStudioVersion = 17.3.32811.315
5MinimumVisualStudioVersion = 15.0.26124.0 5MinimumVisualStudioVersion = 15.0.26124.0
6Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "netcoresearch", "netcoresearch\netcoresearch.vcxproj", "{A7FD9EF2-68CF-4C8E-AD81-3E8A6C7E1937}"
7EndProject
8Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "netfxbe", "be\netfxbe.vcxproj", "{B65719C0-B2CC-45F9-AF33-6F147F741ADB}"
9EndProject
6Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "netfxca", "ca\netfxca.vcxproj", "{F72D34CA-48DA-4DFD-91A9-A0C78BEF6981}" 10Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "netfxca", "ca\netfxca.vcxproj", "{F72D34CA-48DA-4DFD-91A9-A0C78BEF6981}"
7EndProject 11EndProject
8Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "netfx", "wixlib\netfx.wixproj", "{45E4A6AC-3190-4E17-83F0-9935FFA5DC2B}" 12Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "netfx", "wixlib\netfx.wixproj", "{45E4A6AC-3190-4E17-83F0-9935FFA5DC2B}"
@@ -21,14 +25,40 @@ Global
21 Release|x86 = Release|x86 25 Release|x86 = Release|x86
22 EndGlobalSection 26 EndGlobalSection
23 GlobalSection(ProjectConfigurationPlatforms) = postSolution 27 GlobalSection(ProjectConfigurationPlatforms) = postSolution
28 {A7FD9EF2-68CF-4C8E-AD81-3E8A6C7E1937}.Debug|Any CPU.ActiveCfg = Debug|Win32
29 {A7FD9EF2-68CF-4C8E-AD81-3E8A6C7E1937}.Debug|Any CPU.Build.0 = Debug|Win32
30 {A7FD9EF2-68CF-4C8E-AD81-3E8A6C7E1937}.Debug|x64.ActiveCfg = Debug|x64
31 {A7FD9EF2-68CF-4C8E-AD81-3E8A6C7E1937}.Debug|x64.Build.0 = Debug|x64
32 {A7FD9EF2-68CF-4C8E-AD81-3E8A6C7E1937}.Debug|x86.ActiveCfg = Debug|Win32
33 {A7FD9EF2-68CF-4C8E-AD81-3E8A6C7E1937}.Debug|x86.Build.0 = Debug|Win32
34 {A7FD9EF2-68CF-4C8E-AD81-3E8A6C7E1937}.Release|Any CPU.ActiveCfg = Release|Win32
35 {A7FD9EF2-68CF-4C8E-AD81-3E8A6C7E1937}.Release|Any CPU.Build.0 = Release|Win32
36 {A7FD9EF2-68CF-4C8E-AD81-3E8A6C7E1937}.Release|x64.ActiveCfg = Release|x64
37 {A7FD9EF2-68CF-4C8E-AD81-3E8A6C7E1937}.Release|x64.Build.0 = Release|x64
38 {A7FD9EF2-68CF-4C8E-AD81-3E8A6C7E1937}.Release|x86.ActiveCfg = Release|Win32
39 {A7FD9EF2-68CF-4C8E-AD81-3E8A6C7E1937}.Release|x86.Build.0 = Release|Win32
40 {B65719C0-B2CC-45F9-AF33-6F147F741ADB}.Debug|Any CPU.ActiveCfg = Debug|Win32
41 {B65719C0-B2CC-45F9-AF33-6F147F741ADB}.Debug|Any CPU.Build.0 = Debug|Win32
42 {B65719C0-B2CC-45F9-AF33-6F147F741ADB}.Debug|x64.ActiveCfg = Debug|x64
43 {B65719C0-B2CC-45F9-AF33-6F147F741ADB}.Debug|x64.Build.0 = Debug|x64
44 {B65719C0-B2CC-45F9-AF33-6F147F741ADB}.Debug|x86.ActiveCfg = Debug|Win32
45 {B65719C0-B2CC-45F9-AF33-6F147F741ADB}.Debug|x86.Build.0 = Debug|Win32
46 {B65719C0-B2CC-45F9-AF33-6F147F741ADB}.Release|Any CPU.ActiveCfg = Release|Win32
47 {B65719C0-B2CC-45F9-AF33-6F147F741ADB}.Release|Any CPU.Build.0 = Release|Win32
48 {B65719C0-B2CC-45F9-AF33-6F147F741ADB}.Release|x64.ActiveCfg = Release|x64
49 {B65719C0-B2CC-45F9-AF33-6F147F741ADB}.Release|x64.Build.0 = Release|x64
50 {B65719C0-B2CC-45F9-AF33-6F147F741ADB}.Release|x86.ActiveCfg = Release|Win32
51 {B65719C0-B2CC-45F9-AF33-6F147F741ADB}.Release|x86.Build.0 = Release|Win32
24 {F72D34CA-48DA-4DFD-91A9-A0C78BEF6981}.Debug|Any CPU.ActiveCfg = Debug|Win32 52 {F72D34CA-48DA-4DFD-91A9-A0C78BEF6981}.Debug|Any CPU.ActiveCfg = Debug|Win32
25 {F72D34CA-48DA-4DFD-91A9-A0C78BEF6981}.Debug|Any CPU.Build.0 = Debug|Win32 53 {F72D34CA-48DA-4DFD-91A9-A0C78BEF6981}.Debug|Any CPU.Build.0 = Debug|Win32
26 {F72D34CA-48DA-4DFD-91A9-A0C78BEF6981}.Debug|x64.ActiveCfg = Debug|Win32 54 {F72D34CA-48DA-4DFD-91A9-A0C78BEF6981}.Debug|x64.ActiveCfg = Debug|x64
55 {F72D34CA-48DA-4DFD-91A9-A0C78BEF6981}.Debug|x64.Build.0 = Debug|x64
27 {F72D34CA-48DA-4DFD-91A9-A0C78BEF6981}.Debug|x86.ActiveCfg = Debug|Win32 56 {F72D34CA-48DA-4DFD-91A9-A0C78BEF6981}.Debug|x86.ActiveCfg = Debug|Win32
28 {F72D34CA-48DA-4DFD-91A9-A0C78BEF6981}.Debug|x86.Build.0 = Debug|Win32 57 {F72D34CA-48DA-4DFD-91A9-A0C78BEF6981}.Debug|x86.Build.0 = Debug|Win32
29 {F72D34CA-48DA-4DFD-91A9-A0C78BEF6981}.Release|Any CPU.ActiveCfg = Release|Win32 58 {F72D34CA-48DA-4DFD-91A9-A0C78BEF6981}.Release|Any CPU.ActiveCfg = Release|Win32
30 {F72D34CA-48DA-4DFD-91A9-A0C78BEF6981}.Release|Any CPU.Build.0 = Release|Win32 59 {F72D34CA-48DA-4DFD-91A9-A0C78BEF6981}.Release|Any CPU.Build.0 = Release|Win32
31 {F72D34CA-48DA-4DFD-91A9-A0C78BEF6981}.Release|x64.ActiveCfg = Release|Win32 60 {F72D34CA-48DA-4DFD-91A9-A0C78BEF6981}.Release|x64.ActiveCfg = Release|x64
61 {F72D34CA-48DA-4DFD-91A9-A0C78BEF6981}.Release|x64.Build.0 = Release|x64
32 {F72D34CA-48DA-4DFD-91A9-A0C78BEF6981}.Release|x86.ActiveCfg = Release|Win32 62 {F72D34CA-48DA-4DFD-91A9-A0C78BEF6981}.Release|x86.ActiveCfg = Release|Win32
33 {F72D34CA-48DA-4DFD-91A9-A0C78BEF6981}.Release|x86.Build.0 = Release|Win32 63 {F72D34CA-48DA-4DFD-91A9-A0C78BEF6981}.Release|x86.Build.0 = Release|Win32
34 {45E4A6AC-3190-4E17-83F0-9935FFA5DC2B}.Debug|Any CPU.ActiveCfg = Debug|x86 64 {45E4A6AC-3190-4E17-83F0-9935FFA5DC2B}.Debug|Any CPU.ActiveCfg = Debug|x86
diff --git a/src/ext/NetFx/be/NetfxBundleExtension.cpp b/src/ext/NetFx/be/NetfxBundleExtension.cpp
new file mode 100644
index 00000000..838a97c1
--- /dev/null
+++ b/src/ext/NetFx/be/NetfxBundleExtension.cpp
@@ -0,0 +1,102 @@
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#include "precomp.h"
4#include "BextBaseBundleExtension.h"
5
6class CWixNetfxBundleExtension : public CBextBaseBundleExtension
7{
8public: // IBundleExtension
9 virtual STDMETHODIMP Search(
10 __in LPCWSTR wzId,
11 __in LPCWSTR wzVariable
12 )
13 {
14 HRESULT hr = S_OK;
15
16 hr = NetfxSearchExecute(&m_searches, wzId, wzVariable, m_pEngine, m_sczBaseDirectory);
17
18 return hr;
19 }
20
21public: //CBextBaseBundleExtension
22 virtual STDMETHODIMP Initialize(
23 __in const BUNDLE_EXTENSION_CREATE_ARGS* pCreateArgs
24 )
25 {
26 HRESULT hr = S_OK;
27 LPWSTR sczModulePath = NULL;
28 IXMLDOMDocument* pixdManifest = NULL;
29 IXMLDOMNode* pixnBundleExtension = NULL;
30
31 hr = __super::Initialize(pCreateArgs);
32 BextExitOnFailure(hr, "CBextBaseBundleExtension initialization failed.");
33
34 hr = PathForCurrentProcess(&sczModulePath, m_hInstance);
35 BextExitOnFailure(hr, "Failed to get bundle extension path.");
36
37 hr = PathGetDirectory(sczModulePath, &m_sczBaseDirectory);
38 BextExitOnFailure(hr, "Failed to get bundle extension base directory.");
39
40 hr = XmlLoadDocumentFromFile(m_sczBundleExtensionDataPath, &pixdManifest);
41 BextExitOnFailure(hr, "Failed to load bundle extension manifest from path: %ls", m_sczBundleExtensionDataPath);
42
43 hr = BextGetBundleExtensionDataNode(pixdManifest, NETFX_BUNDLE_EXTENSION_ID, &pixnBundleExtension);
44 BextExitOnFailure(hr, "Failed to get BundleExtension '%ls'", NETFX_BUNDLE_EXTENSION_ID);
45
46 hr = NetfxSearchParseFromXml(&m_searches, pixnBundleExtension);
47 BextExitOnFailure(hr, "Failed to parse searches from bundle extension manifest.");
48
49 LExit:
50 ReleaseObject(pixnBundleExtension);
51 ReleaseObject(pixdManifest);
52 ReleaseStr(sczModulePath);
53
54 return hr;
55 }
56
57public:
58 CWixNetfxBundleExtension(
59 __in HINSTANCE hInstance,
60 __in IBundleExtensionEngine* pEngine
61 ) : CBextBaseBundleExtension(pEngine)
62 {
63 m_searches = { };
64 m_hInstance = hInstance;
65 m_sczBaseDirectory = NULL;
66 }
67
68 ~CWixNetfxBundleExtension()
69 {
70 NetfxSearchUninitialize(&m_searches);
71 ReleaseStr(m_sczBaseDirectory);
72 }
73
74private:
75 NETFX_SEARCHES m_searches;
76 HINSTANCE m_hInstance;
77 LPWSTR m_sczBaseDirectory;
78};
79
80HRESULT NetfxBundleExtensionCreate(
81 __in HINSTANCE hInstance,
82 __in IBundleExtensionEngine* pEngine,
83 __in const BUNDLE_EXTENSION_CREATE_ARGS* pArgs,
84 __out IBundleExtension** ppBundleExtension
85 )
86{
87 HRESULT hr = S_OK;
88 CWixNetfxBundleExtension* pExtension = NULL;
89
90 pExtension = new CWixNetfxBundleExtension(hInstance, pEngine);
91 BextExitOnNull(pExtension, hr, E_OUTOFMEMORY, "Failed to create new CWixNetfxBundleExtension.");
92
93 hr = pExtension->Initialize(pArgs);
94 BextExitOnFailure(hr, "CWixNetfxBundleExtension initialization failed.");
95
96 *ppBundleExtension = pExtension;
97 pExtension = NULL;
98
99LExit:
100 ReleaseObject(pExtension);
101 return hr;
102}
diff --git a/src/ext/NetFx/be/NetfxBundleExtension.h b/src/ext/NetFx/be/NetfxBundleExtension.h
new file mode 100644
index 00000000..0746dbed
--- /dev/null
+++ b/src/ext/NetFx/be/NetfxBundleExtension.h
@@ -0,0 +1,17 @@
1#pragma once
2// 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.
3
4
5// constants
6
7#define NETFX_BUNDLE_EXTENSION_ID BUNDLE_EXTENSION_DECORATION(L"NetfxBundleExtension")
8
9
10// function declarations
11
12HRESULT NetfxBundleExtensionCreate(
13 __in HINSTANCE hInstance,
14 __in IBundleExtensionEngine* pEngine,
15 __in const BUNDLE_EXTENSION_CREATE_ARGS* pArgs,
16 __out IBundleExtension** ppBundleExtension
17 );
diff --git a/src/ext/NetFx/be/detectnetcore.cpp b/src/ext/NetFx/be/detectnetcore.cpp
new file mode 100644
index 00000000..42156692
--- /dev/null
+++ b/src/ext/NetFx/be/detectnetcore.cpp
@@ -0,0 +1,140 @@
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#include "precomp.h"
4
5HRESULT DetectNetCore(
6 __in NETFX_NET_CORE_PLATFORM platform,
7 __in NETFX_NET_CORE_RUNTIME_TYPE runtimeType,
8 __in LPCWSTR wzMajorVersion,
9 __in LPCWSTR wzBaseDirectory,
10 __inout LPWSTR* psczLatestVersion
11 )
12{
13 HRESULT hr = S_OK;
14 LPCWSTR wzRuntimeType = NULL;
15 LPCWSTR wzPlatformName = NULL;
16 LPWSTR sczExePath = NULL;
17 LPWSTR sczCommandLine = NULL;
18 HANDLE hProcess = NULL;
19 HANDLE hStdOutErr = INVALID_HANDLE_VALUE;
20 BYTE* rgbOutput = NULL;
21 DWORD cbOutput = 0;
22 DWORD cbTotalRead = 0;
23 DWORD cbRead = 0;
24 DWORD dwExitCode = 0;
25
26 ReleaseNullStr(*psczLatestVersion);
27
28 switch (runtimeType)
29 {
30 case NETFX_NET_CORE_RUNTIME_TYPE_ASPNET:
31 wzRuntimeType = L"Microsoft.AspNetCore.App";
32 break;
33 case NETFX_NET_CORE_RUNTIME_TYPE_CORE:
34 wzRuntimeType = L"Microsoft.NETCore.App";
35 break;
36 case NETFX_NET_CORE_RUNTIME_TYPE_DESKTOP:
37 wzRuntimeType = L"Microsoft.WindowsDesktop.App";
38 break;
39 default:
40 BextExitWithRootFailure(hr, E_INVALIDARG, "Unknown runtime type: %u", runtimeType);
41 break;
42 }
43
44 switch (platform)
45 {
46 case NETFX_NET_CORE_PLATFORM_ARM64:
47 wzPlatformName = L"arm64";
48 break;
49 case NETFX_NET_CORE_PLATFORM_X64:
50 wzPlatformName = L"x64";
51 break;
52 case NETFX_NET_CORE_PLATFORM_X86:
53 wzPlatformName = L"x86";
54 break;
55 default:
56 BextExitWithRootFailure(hr, E_INVALIDARG, "Unknown platform: %u", platform);
57 break;
58 }
59
60 hr = StrAllocFormatted(&sczExePath, L"%ls%ls\\netcoresearch.exe", wzBaseDirectory, wzPlatformName);
61 BextExitOnFailure(hr, "Failed to build netcoresearch.exe path.");
62
63 hr = StrAllocFormatted(&sczCommandLine, L"\"%ls\" %ls %ls", sczExePath, wzMajorVersion, wzRuntimeType);
64 BextExitOnFailure(hr, "Failed to build netcoresearch.exe command line.");
65
66 hr = ProcExecute(sczExePath, sczCommandLine, &hProcess, NULL, &hStdOutErr);
67 if (HRESULT_FROM_WIN32(ERROR_EXE_MACHINE_TYPE_MISMATCH) == hr)
68 {
69 ExitFunction1(hr = S_FALSE);
70 }
71 BextExitOnFailure(hr, "Failed to run: %ls", sczCommandLine);
72
73 cbOutput = 64;
74
75 rgbOutput = reinterpret_cast<BYTE*>(MemAlloc(cbOutput, TRUE));
76 BextExitOnNull(rgbOutput, hr, E_OUTOFMEMORY, "Failed to alloc output string.");
77
78 while (::ReadFile(hStdOutErr, rgbOutput + cbTotalRead, cbOutput - cbTotalRead, &cbRead, NULL))
79 {
80 cbTotalRead += cbRead;
81
82 if (cbTotalRead == cbOutput)
83 {
84 cbOutput *= 2;
85
86 LPVOID pvNew = MemReAlloc(rgbOutput, cbOutput, TRUE);
87 BextExitOnNull(pvNew, hr, E_OUTOFMEMORY, "Failed to realloc output string.");
88
89 rgbOutput = reinterpret_cast<BYTE*>(pvNew);
90 }
91 }
92
93 if (ERROR_BROKEN_PIPE != ::GetLastError())
94 {
95 BextExitWithLastError(hr, "Failed to read netcoresearch.exe output.");
96 }
97
98 hr = ProcWaitForCompletion(hProcess, INFINITE, &dwExitCode);
99 BextExitOnFailure(hr, "Failed to wait for netcoresearch.exe to exit.");
100
101 if (0 != dwExitCode)
102 {
103 BextExitWithRootFailure(hr, E_UNEXPECTED, "netcoresearch.exe failed with exit code: 0x%x\r\nOutput:\r\n%hs", dwExitCode, rgbOutput);
104 }
105
106 if (*rgbOutput)
107 {
108 hr = StrAllocStringAnsi(psczLatestVersion, reinterpret_cast<LPSTR>(rgbOutput), 0, CP_UTF8);
109 BextExitOnFailure(hr, "Failed to widen output string: %hs", rgbOutput);
110 }
111
112LExit:
113 ReleaseFileHandle(hStdOutErr);
114 ReleaseHandle(hProcess);
115 ReleaseMem(rgbOutput);
116 ReleaseStr(sczCommandLine);
117 ReleaseStr(sczExePath);
118
119 return hr;
120}
121
122HRESULT NetfxPerformDetectNetCore(
123 __in LPCWSTR wzVariable,
124 __in NETFX_SEARCH* pSearch,
125 __in IBundleExtensionEngine* pEngine,
126 __in LPCWSTR wzBaseDirectory
127 )
128{
129 HRESULT hr = S_OK;
130 LPWSTR sczLatestVersion = FALSE;
131
132 hr = DetectNetCore(pSearch->NetCoreSearch.platform, pSearch->NetCoreSearch.runtimeType, pSearch->NetCoreSearch.sczMajorVersion, wzBaseDirectory, &sczLatestVersion);
133 BextExitOnFailure(hr, "DetectNetCore failed.");
134
135 hr = pEngine->SetVariableVersion(wzVariable, sczLatestVersion);
136 BextExitOnFailure(hr, "Failed to set variable '%ls' to '%ls'", wzVariable, sczLatestVersion);
137
138LExit:
139 return hr;
140}
diff --git a/src/ext/NetFx/be/detectnetcore.h b/src/ext/NetFx/be/detectnetcore.h
new file mode 100644
index 00000000..ef93b39b
--- /dev/null
+++ b/src/ext/NetFx/be/detectnetcore.h
@@ -0,0 +1,9 @@
1#pragma once
2// 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.
3
4HRESULT NetfxPerformDetectNetCore(
5 __in LPCWSTR wzVariable,
6 __in NETFX_SEARCH* pSearch,
7 __in IBundleExtensionEngine* pEngine,
8 __in LPCWSTR wzBaseDirectory
9 );
diff --git a/src/ext/NetFx/be/netfxbe.cpp b/src/ext/NetFx/be/netfxbe.cpp
new file mode 100644
index 00000000..3a34cea3
--- /dev/null
+++ b/src/ext/NetFx/be/netfxbe.cpp
@@ -0,0 +1,62 @@
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#include "precomp.h"
4#include "BextBaseBundleExtensionProc.h"
5
6static HINSTANCE vhInstance = NULL;
7static IBundleExtension* vpBundleExtension = NULL;
8
9// function definitions
10
11extern "C" BOOL WINAPI DllMain(
12 __in HINSTANCE hInstance,
13 __in DWORD dwReason,
14 __in LPVOID /*pvReserved*/
15 )
16{
17 switch(dwReason)
18 {
19 case DLL_PROCESS_ATTACH:
20 vhInstance = hInstance;
21 break;
22
23 case DLL_PROCESS_DETACH:
24 vhInstance = NULL;
25 break;
26 }
27
28 return TRUE;
29}
30
31extern "C" HRESULT WINAPI BundleExtensionCreate(
32 __in const BUNDLE_EXTENSION_CREATE_ARGS* pArgs,
33 __inout BUNDLE_EXTENSION_CREATE_RESULTS* pResults
34 )
35{
36 HRESULT hr = S_OK;
37 IBundleExtensionEngine* pEngine = NULL;
38
39 hr = XmlInitialize();
40 ExitOnFailure(hr, "Failed to initialize XML.");
41
42 hr = BextInitializeFromCreateArgs(pArgs, &pEngine);
43 ExitOnFailure(hr, "Failed to initialize bext");
44
45 hr = NetfxBundleExtensionCreate(vhInstance, pEngine, pArgs, &vpBundleExtension);
46 BextExitOnFailure(hr, "Failed to create WixNetfxBundleExtension");
47
48 pResults->pfnBundleExtensionProc = BextBaseBundleExtensionProc;
49 pResults->pvBundleExtensionProcContext = vpBundleExtension;
50
51LExit:
52 ReleaseObject(pEngine);
53
54 return hr;
55}
56
57extern "C" void WINAPI BundleExtensionDestroy()
58{
59 BextUninitialize();
60 ReleaseNullObject(vpBundleExtension);
61 XmlUninitialize();
62}
diff --git a/src/ext/NetFx/be/netfxbe.def b/src/ext/NetFx/be/netfxbe.def
new file mode 100644
index 00000000..c6605241
--- /dev/null
+++ b/src/ext/NetFx/be/netfxbe.def
@@ -0,0 +1,8 @@
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
4LIBRARY "netfxbe"
5
6EXPORTS
7 BundleExtensionCreate
8 BundleExtensionDestroy
diff --git a/src/ext/NetFx/be/netfxbe.vcxproj b/src/ext/NetFx/be/netfxbe.vcxproj
new file mode 100644
index 00000000..00588764
--- /dev/null
+++ b/src/ext/NetFx/be/netfxbe.vcxproj
@@ -0,0 +1,77 @@
1<?xml version="1.0" encoding="utf-8"?>
2<!-- 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. -->
3
4<Project DefaultTargets="Build" Toolsxmlns="http://schemas.microsoft.com/developer/msbuild/2003">
5 <ItemGroup Label="ProjectConfigurations">
6 <ProjectConfiguration Include="Debug|ARM64">
7 <Configuration>Debug</Configuration>
8 <Platform>ARM64</Platform>
9 </ProjectConfiguration>
10 <ProjectConfiguration Include="Release|ARM64">
11 <Configuration>Release</Configuration>
12 <Platform>ARM64</Platform>
13 </ProjectConfiguration>
14 <ProjectConfiguration Include="Debug|X64">
15 <Configuration>Debug</Configuration>
16 <Platform>X64</Platform>
17 </ProjectConfiguration>
18 <ProjectConfiguration Include="Release|X64">
19 <Configuration>Release</Configuration>
20 <Platform>X64</Platform>
21 </ProjectConfiguration>
22 <ProjectConfiguration Include="Debug|Win32">
23 <Configuration>Debug</Configuration>
24 <Platform>Win32</Platform>
25 </ProjectConfiguration>
26 <ProjectConfiguration Include="Release|Win32">
27 <Configuration>Release</Configuration>
28 <Platform>Win32</Platform>
29 </ProjectConfiguration>
30 </ItemGroup>
31
32 <PropertyGroup Label="Globals">
33 <ProjectGuid>{B65719C0-B2CC-45F9-AF33-6F147F741ADB}</ProjectGuid>
34 <ConfigurationType>DynamicLibrary</ConfigurationType>
35 <TargetName>netfxbe</TargetName>
36 <CharacterSet>Unicode</CharacterSet>
37 <ProjectModuleDefinitionFile>netfxbe.def</ProjectModuleDefinitionFile>
38 <Description>WiX Toolset Netfx BundleExtension</Description>
39 </PropertyGroup>
40
41 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
42 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
43
44 <PropertyGroup>
45 <ProjectAdditionalLinkLibraries>msi.lib</ProjectAdditionalLinkLibraries>
46 </PropertyGroup>
47
48 <ItemGroup>
49 <ClCompile Include="detectnetcore.cpp" />
50 <ClCompile Include="netfxbe.cpp" />
51 <ClCompile Include="NetfxBundleExtension.cpp" />
52 <ClCompile Include="netfxsearch.cpp" />
53 <ClCompile Include="precomp.cpp">
54 <PrecompiledHeader>Create</PrecompiledHeader>
55 </ClCompile>
56 </ItemGroup>
57
58 <ItemGroup>
59 <ClInclude Include="detectnetcore.h" />
60 <ClInclude Include="NetfxBundleExtension.h" />
61 <ClInclude Include="netfxsearch.h" />
62 <ClInclude Include="precomp.h" />
63 </ItemGroup>
64
65 <ItemGroup>
66 <None Include="netfxbe.def" />
67 </ItemGroup>
68
69 <ItemGroup>
70 <PackageReference Include="WixToolset.BextUtil" />
71
72 <PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" />
73 <PackageReference Include="GitInfo" PrivateAssets="All" />
74 </ItemGroup>
75
76 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
77</Project>
diff --git a/src/ext/NetFx/be/netfxsearch.cpp b/src/ext/NetFx/be/netfxsearch.cpp
new file mode 100644
index 00000000..3c12161d
--- /dev/null
+++ b/src/ext/NetFx/be/netfxsearch.cpp
@@ -0,0 +1,149 @@
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#include "precomp.h"
4
5
6STDMETHODIMP NetfxSearchParseFromXml(
7 __in NETFX_SEARCHES* pSearches,
8 __in IXMLDOMNode* pixnBundleExtension
9 )
10{
11 HRESULT hr = S_OK;
12 IXMLDOMNodeList* pixnNodes = NULL;
13 IXMLDOMNode* pixnNode = NULL;
14 DWORD cNodes = 0;
15 BSTR bstrNodeName = NULL;
16
17 // Select Netfx search nodes.
18 hr = XmlSelectNodes(pixnBundleExtension, L"NetFxNetCoreSearch", &pixnNodes);
19 BextExitOnFailure(hr, "Failed to select Netfx search nodes.");
20
21 // Get Netfx search node count.
22 hr = pixnNodes->get_length((long*)&cNodes);
23 BextExitOnFailure(hr, "Failed to get Netfx search node count.");
24
25 if (!cNodes)
26 {
27 ExitFunction();
28 }
29
30 // Allocate memory for searches.
31 pSearches->rgSearches = (NETFX_SEARCH*)MemAlloc(sizeof(NETFX_SEARCH) * cNodes, TRUE);
32 BextExitOnNull(pSearches->rgSearches, hr, E_OUTOFMEMORY, "Failed to allocate memory for search structs.");
33
34 pSearches->cSearches = cNodes;
35
36 // Parse search elements.
37 for (DWORD i = 0; i < cNodes; ++i)
38 {
39 NETFX_SEARCH* pSearch = &pSearches->rgSearches[i];
40
41 hr = XmlNextElement(pixnNodes, &pixnNode, &bstrNodeName);
42 BextExitOnFailure(hr, "Failed to get next node.");
43
44 // @Id
45 hr = XmlGetAttributeEx(pixnNode, L"Id", &pSearch->sczId);
46 BextExitOnFailure(hr, "Failed to get @Id.");
47
48 // Read type specific attributes.
49 if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, bstrNodeName, -1, L"NetFxNetCoreSearch", -1))
50 {
51 pSearch->Type = NETFX_SEARCH_TYPE_NET_CORE_SEARCH;
52
53 // @RuntimeType
54 hr = XmlGetAttributeUInt32(pixnNode, L"RuntimeType", reinterpret_cast<DWORD*>(&pSearch->NetCoreSearch.runtimeType));
55 BextExitOnFailure(hr, "Failed to get @RuntimeType.");
56
57 // @Platform
58 hr = XmlGetAttributeUInt32(pixnNode, L"Platform", reinterpret_cast<DWORD*>(&pSearch->NetCoreSearch.platform));
59 BextExitOnFailure(hr, "Failed to get @Platform.");
60
61 // @MajorVersion
62 hr = XmlGetAttributeEx(pixnNode, L"MajorVersion", &pSearch->NetCoreSearch.sczMajorVersion);
63 BextExitOnFailure(hr, "Failed to get @MajorVersion.");
64 }
65 else
66 {
67 BextExitWithRootFailure(hr, E_UNEXPECTED, "Unexpected element name: %ls", bstrNodeName);
68 }
69
70 // prepare next iteration
71 ReleaseNullObject(pixnNode);
72 ReleaseNullBSTR(bstrNodeName);
73 }
74
75LExit:
76 ReleaseBSTR(bstrNodeName);
77 ReleaseObject(pixnNode);
78 ReleaseObject(pixnNodes);
79
80 return hr;
81}
82
83void NetfxSearchUninitialize(
84 __in NETFX_SEARCHES* pSearches
85 )
86{
87 if (pSearches->rgSearches)
88 {
89 for (DWORD i = 0; i < pSearches->cSearches; ++i)
90 {
91 NETFX_SEARCH* pSearch = &pSearches->rgSearches[i];
92
93 ReleaseStr(pSearch->sczId);
94 }
95 MemFree(pSearches->rgSearches);
96 }
97}
98
99STDMETHODIMP NetfxSearchExecute(
100 __in NETFX_SEARCHES* pSearches,
101 __in LPCWSTR wzSearchId,
102 __in LPCWSTR wzVariable,
103 __in IBundleExtensionEngine* pEngine,
104 __in LPCWSTR wzBaseDirectory
105 )
106{
107 HRESULT hr = S_OK;
108 NETFX_SEARCH* pSearch = NULL;
109
110 hr = NetfxSearchFindById(pSearches, wzSearchId, &pSearch);
111 BextExitOnFailure(hr, "Search id '%ls' is unknown to the util extension.", wzSearchId);
112
113 switch (pSearch->Type)
114 {
115 case NETFX_SEARCH_TYPE_NET_CORE_SEARCH:
116 hr = NetfxPerformDetectNetCore(wzVariable, pSearch, pEngine, wzBaseDirectory);
117 break;
118 default:
119 hr = E_UNEXPECTED;
120 }
121
122LExit:
123 return hr;
124}
125
126STDMETHODIMP NetfxSearchFindById(
127 __in NETFX_SEARCHES* pSearches,
128 __in LPCWSTR wzId,
129 __out NETFX_SEARCH** ppSearch
130 )
131{
132 HRESULT hr = S_OK;
133
134 for (DWORD i = 0; i < pSearches->cSearches; ++i)
135 {
136 NETFX_SEARCH* pSearch = &pSearches->rgSearches[i];
137
138 if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, pSearch->sczId, -1, wzId, -1))
139 {
140 *ppSearch = pSearch;
141 ExitFunction1(hr = S_OK);
142 }
143 }
144
145 hr = E_NOTFOUND;
146
147LExit:
148 return hr;
149}
diff --git a/src/ext/NetFx/be/netfxsearch.h b/src/ext/NetFx/be/netfxsearch.h
new file mode 100644
index 00000000..ae250690
--- /dev/null
+++ b/src/ext/NetFx/be/netfxsearch.h
@@ -0,0 +1,76 @@
1#pragma once
2// 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.
3
4
5// constants
6
7enum NETFX_SEARCH_TYPE
8{
9 NETFX_SEARCH_TYPE_NONE,
10 NETFX_SEARCH_TYPE_NET_CORE_SEARCH,
11};
12
13enum NETFX_NET_CORE_RUNTIME_TYPE
14{
15 NETFX_NET_CORE_RUNTIME_TYPE_CORE,
16 NETFX_NET_CORE_RUNTIME_TYPE_ASPNET,
17 NETFX_NET_CORE_RUNTIME_TYPE_DESKTOP,
18};
19
20enum NETFX_NET_CORE_PLATFORM
21{
22 NETFX_NET_CORE_PLATFORM_X86,
23 NETFX_NET_CORE_PLATFORM_X64,
24 NETFX_NET_CORE_PLATFORM_ARM64,
25};
26
27
28// structs
29
30typedef struct _NETFX_SEARCH
31{
32 LPWSTR sczId;
33
34 NETFX_SEARCH_TYPE Type;
35 union
36 {
37 struct
38 {
39 NETFX_NET_CORE_RUNTIME_TYPE runtimeType;
40 NETFX_NET_CORE_PLATFORM platform;
41 LPWSTR sczMajorVersion;
42 } NetCoreSearch;
43 };
44} NETFX_SEARCH;
45
46typedef struct _NETFX_SEARCHES
47{
48 NETFX_SEARCH* rgSearches;
49 DWORD cSearches;
50} NETFX_SEARCHES;
51
52
53// function declarations
54
55STDMETHODIMP NetfxSearchParseFromXml(
56 __in NETFX_SEARCHES* pSearches,
57 __in IXMLDOMNode* pixnBundleExtension
58 );
59
60void NetfxSearchUninitialize(
61 __in NETFX_SEARCHES* pSearches
62 );
63
64STDMETHODIMP NetfxSearchExecute(
65 __in NETFX_SEARCHES* pSearches,
66 __in LPCWSTR wzSearchId,
67 __in LPCWSTR wzVariable,
68 __in IBundleExtensionEngine* pEngine,
69 __in LPCWSTR wzBaseDirectory
70 );
71
72STDMETHODIMP NetfxSearchFindById(
73 __in NETFX_SEARCHES* pSearches,
74 __in LPCWSTR wzId,
75 __out NETFX_SEARCH** ppSearch
76 );
diff --git a/src/ext/NetFx/be/precomp.cpp b/src/ext/NetFx/be/precomp.cpp
new file mode 100644
index 00000000..37664a1c
--- /dev/null
+++ b/src/ext/NetFx/be/precomp.cpp
@@ -0,0 +1,3 @@
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#include "precomp.h"
diff --git a/src/ext/NetFx/be/precomp.h b/src/ext/NetFx/be/precomp.h
new file mode 100644
index 00000000..33aea9bc
--- /dev/null
+++ b/src/ext/NetFx/be/precomp.h
@@ -0,0 +1,33 @@
1#pragma once
2// 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.
3
4
5#include <windows.h>
6#include <msiquery.h>
7#include <msidefs.h>
8#include <stierr.h>
9
10#include <strsafe.h>
11
12#include <msxml2.h>
13
14#include <dutil.h>
15#include <fileutil.h>
16#include <memutil.h>
17#include <strutil.h>
18#include <pathutil.h>
19#include <procutil.h>
20#include <xmlutil.h>
21
22#include <BundleExtensionEngine.h>
23#include <BundleExtension.h>
24
25#include <IBundleExtensionEngine.h>
26#include <IBundleExtension.h>
27#include <bextutil.h>
28#include <BextBundleExtensionEngine.h>
29
30#include "..\..\beDecor.h"
31#include "netfxsearch.h"
32#include "detectnetcore.h"
33#include "NetfxBundleExtension.h"
diff --git a/src/ext/NetFx/netcoresearch/netcoresearch.cpp b/src/ext/NetFx/netcoresearch/netcoresearch.cpp
new file mode 100644
index 00000000..b2dad9a8
--- /dev/null
+++ b/src/ext/NetFx/netcoresearch/netcoresearch.cpp
@@ -0,0 +1,158 @@
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#include "precomp.h"
4
5struct NETCORESEARCH_STATE
6{
7 LPCWSTR wzTargetName;
8 DWORD dwMajorVersion;
9 VERUTIL_VERSION* pVersion;
10};
11
12static HRESULT GetDotnetEnvironmentInfo(
13 __in DWORD dwMajorVersion,
14 __in_z LPCWSTR wzTargetName,
15 __inout VERUTIL_VERSION** ppVersion
16 );
17static void HOSTFXR_CALLTYPE GetDotnetEnvironmentInfoResult(
18 __in const hostfxr_dotnet_environment_info* pInfo,
19 __in LPVOID pvContext
20 );
21
22int __cdecl wmain(int argc, LPWSTR argv[])
23{
24 HRESULT hr = S_OK;
25 DWORD dwMajorVersion = 0;
26 VERUTIL_VERSION* pVersion = NULL;
27 LPSTR pszVersion = NULL;
28
29 ::SetConsoleCP(CP_UTF8);
30
31 ConsoleInitialize();
32
33 if (argc != 3)
34 {
35 ExitFunction1(hr = E_INVALIDARG);
36 }
37
38 hr = StrStringToUInt32(argv[1], 0, reinterpret_cast<UINT*>(&dwMajorVersion));
39 ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to get target version from: %ls", argv[1]);
40
41 hr = GetDotnetEnvironmentInfo(dwMajorVersion, argv[2], &pVersion);
42 ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to search for .NET Core.");
43
44 if (pVersion)
45 {
46 hr = StrAnsiAllocString(&pszVersion, pVersion->sczVersion, 0, CP_UTF8);
47 ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to convert version to UTF-8.");
48
49 ConsoleWrite(CONSOLE_COLOR_NORMAL, "%hs", pszVersion);
50 }
51
52LExit:
53 ReleaseStr(pszVersion);
54 ReleaseVerutilVersion(pVersion);
55 ConsoleUninitialize();
56 return hr;
57}
58
59static HRESULT GetDotnetEnvironmentInfo(
60 __in DWORD dwMajorVersion,
61 __in_z LPCWSTR wzTargetName,
62 __inout VERUTIL_VERSION** ppVersion
63 )
64{
65 HRESULT hr = S_OK;
66 LPWSTR sczProcessPath = NULL;
67 LPWSTR sczHostfxrPath = NULL;
68 HMODULE hModule = NULL;
69 hostfxr_get_dotnet_environment_info_fn pfnGetDotnetEnvironmentInfo = NULL;
70 NETCORESEARCH_STATE state = { };
71
72 state.dwMajorVersion = dwMajorVersion;
73 state.wzTargetName = wzTargetName;
74
75 hr = PathForCurrentProcess(&sczProcessPath, NULL);
76 ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to get process path.");
77
78 hr = PathGetDirectory(sczProcessPath, &sczHostfxrPath);
79 ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to get process directory.");
80
81 hr = StrAllocConcat(&sczHostfxrPath, L"hostfxr.dll", 0);
82 ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to build hostfxr path.");
83
84 hModule = ::LoadLibraryExW(sczHostfxrPath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
85 ConsoleExitOnNullWithLastError(hModule, hr, CONSOLE_COLOR_RED, "Failed to load hostfxr.");
86
87 pfnGetDotnetEnvironmentInfo = (hostfxr_get_dotnet_environment_info_fn)::GetProcAddress(hModule, "hostfxr_get_dotnet_environment_info");
88 ConsoleExitOnNullWithLastError(pfnGetDotnetEnvironmentInfo, hr, CONSOLE_COLOR_RED, "Failed to get address for hostfxr_get_dotnet_environment_info.");
89
90 hr = pfnGetDotnetEnvironmentInfo(NULL, NULL, GetDotnetEnvironmentInfoResult, &state);
91 ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to get .NET Core environment info.");
92
93 if (state.pVersion)
94 {
95 *ppVersion = state.pVersion;
96 state.pVersion = NULL;
97 }
98
99LExit:
100 ReleaseVerutilVersion(state.pVersion);
101 ReleaseStr(sczHostfxrPath);
102 ReleaseStr(sczProcessPath);
103
104 if (hModule)
105 {
106 ::FreeLibrary(hModule);
107 }
108
109 return hr;
110}
111
112static void HOSTFXR_CALLTYPE GetDotnetEnvironmentInfoResult(
113 __in const hostfxr_dotnet_environment_info* pInfo,
114 __in LPVOID pvContext
115 )
116{
117 NETCORESEARCH_STATE* pState = reinterpret_cast<NETCORESEARCH_STATE*>(pvContext);
118 HRESULT hr = S_OK;
119 VERUTIL_VERSION* pFrameworkVersion = NULL;
120 int nCompare = 0;
121
122 for (size_t i = 0; i < pInfo->framework_count; ++i)
123 {
124 const hostfxr_dotnet_environment_framework_info* pFrameworkInfo = pInfo->frameworks + i;
125 ReleaseVerutilVersion(pFrameworkVersion);
126
127 if (CSTR_EQUAL != ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, pState->wzTargetName, -1, pFrameworkInfo->name, -1))
128 {
129 continue;
130 }
131
132 hr = VerParseVersion(pFrameworkInfo->version, 0, FALSE, &pFrameworkVersion);
133 ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to parse framework version: %ls", pFrameworkInfo->version);
134
135 if (pFrameworkVersion->dwMajor != pState->dwMajorVersion)
136 {
137 continue;
138 }
139
140 if (pState->pVersion)
141 {
142 hr = VerCompareParsedVersions(pState->pVersion, pFrameworkVersion, &nCompare);
143 ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to compare versions.");
144
145 if (nCompare > -1)
146 {
147 continue;
148 }
149 }
150
151 ReleaseVerutilVersion(pState->pVersion);
152 pState->pVersion = pFrameworkVersion;
153 pFrameworkVersion = NULL;
154 }
155
156LExit:
157 ReleaseVerutilVersion(pFrameworkVersion);
158}
diff --git a/src/ext/NetFx/netcoresearch/netcoresearch.h b/src/ext/NetFx/netcoresearch/netcoresearch.h
new file mode 100644
index 00000000..d25b13f9
--- /dev/null
+++ b/src/ext/NetFx/netcoresearch/netcoresearch.h
@@ -0,0 +1,10 @@
1#pragma once
2// 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.
3
4// TODO: remove when definition is provided in hostfxr.h.
5typedef int32_t(HOSTFXR_CALLTYPE* hostfxr_get_dotnet_environment_info_fn)(
6 const char_t* dotnet_root,
7 void* reserved,
8 hostfxr_get_dotnet_environment_info_result_fn result,
9 void* result_context
10 );
diff --git a/src/ext/NetFx/netcoresearch/netcoresearch.vcxproj b/src/ext/NetFx/netcoresearch/netcoresearch.vcxproj
new file mode 100644
index 00000000..b5f12f07
--- /dev/null
+++ b/src/ext/NetFx/netcoresearch/netcoresearch.vcxproj
@@ -0,0 +1,73 @@
1<?xml version="1.0" encoding="utf-8"?>
2<!-- 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. -->
3<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
4 <ItemGroup Label="ProjectConfigurations">
5 <ProjectConfiguration Include="Debug|ARM64">
6 <Configuration>Debug</Configuration>
7 <Platform>ARM64</Platform>
8 </ProjectConfiguration>
9 <ProjectConfiguration Include="Release|ARM64">
10 <Configuration>Release</Configuration>
11 <Platform>ARM64</Platform>
12 </ProjectConfiguration>
13 <ProjectConfiguration Include="Debug|Win32">
14 <Configuration>Debug</Configuration>
15 <Platform>Win32</Platform>
16 </ProjectConfiguration>
17 <ProjectConfiguration Include="Release|Win32">
18 <Configuration>Release</Configuration>
19 <Platform>Win32</Platform>
20 </ProjectConfiguration>
21 <ProjectConfiguration Include="Debug|x64">
22 <Configuration>Debug</Configuration>
23 <Platform>x64</Platform>
24 </ProjectConfiguration>
25 <ProjectConfiguration Include="Release|x64">
26 <Configuration>Release</Configuration>
27 <Platform>x64</Platform>
28 </ProjectConfiguration>
29 </ItemGroup>
30
31 <PropertyGroup Label="Globals">
32 <ProjectGuid>{A7FD9EF2-68CF-4C8E-AD81-3E8A6C7E1937}</ProjectGuid>
33 <ConfigurationType>Application</ConfigurationType>
34 <CharacterSet>Unicode</CharacterSet>
35 <ProjectSubSystem>Console</ProjectSubSystem>
36 <TargetName>netcoresearch</TargetName>
37 </PropertyGroup>
38
39 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
40 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
41
42 <PropertyGroup>
43 <NetHostPlatform>$(Platform)</NetHostPlatform>
44 <NetHostPlatform Condition=" '$(NetHostPlatform)'=='Win32' ">x86</NetHostPlatform>
45 <NetHostPath>..\..\..\..\packages\runtime.win-$(NetHostPlatform).Microsoft.NETCore.DotNetAppHost.6.0.4\runtimes\win-$(NetHostPlatform)\native\</NetHostPath>
46 <HostfxrPath>..\..\..\..\packages\runtime.win-$(NetHostPlatform).Microsoft.NETCore.DotNetHostResolver.6.0.4\runtimes\win-$(NetHostPlatform)\native\</HostfxrPath>
47 <ProjectAdditionalIncludeDirectories>$(NetHostPath)</ProjectAdditionalIncludeDirectories>
48 </PropertyGroup>
49
50 <ItemGroup>
51 <ClCompile Include="netcoresearch.cpp" />
52 <ClCompile Include="precomp.cpp">
53 <PrecompiledHeader>Create</PrecompiledHeader>
54 </ClCompile>
55 </ItemGroup>
56
57 <ItemGroup>
58 <ClInclude Include="netcoresearch.h" />
59 <ClInclude Include="precomp.h" />
60 </ItemGroup>
61
62 <ItemGroup>
63 <PackageReference Include="WixToolset.Dutil" />
64 <PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" />
65 <PackageReference Include="GitInfo" PrivateAssets="All" />
66 </ItemGroup>
67
68 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
69
70 <Target Name="CopyHostfxr" AfterTargets="Build">
71 <Copy SourceFiles="$(HostfxrPath)hostfxr.dll" DestinationFolder="$(OutputPath)" />
72 </Target>
73</Project>
diff --git a/src/ext/NetFx/netcoresearch/packages.config b/src/ext/NetFx/netcoresearch/packages.config
new file mode 100644
index 00000000..ad26db1c
--- /dev/null
+++ b/src/ext/NetFx/netcoresearch/packages.config
@@ -0,0 +1,9 @@
1<?xml version="1.0" encoding="utf-8"?>
2<packages>
3 <package id="runtime.win-arm64.Microsoft.NETCore.DotNetAppHost" version="6.0.4" targetFramework="native" />
4 <package id="runtime.win-x64.Microsoft.NETCore.DotNetAppHost" version="6.0.4" targetFramework="native" />
5 <package id="runtime.win-x86.Microsoft.NETCore.DotNetAppHost" version="6.0.4" targetFramework="native" />
6 <package id="runtime.win-arm64.Microsoft.NETCore.DotNetHostResolver" version="6.0.4" targetFramework="native" />
7 <package id="runtime.win-x64.Microsoft.NETCore.DotNetHostResolver" version="6.0.4" targetFramework="native" />
8 <package id="runtime.win-x86.Microsoft.NETCore.DotNetHostResolver" version="6.0.4" targetFramework="native" />
9</packages> \ No newline at end of file
diff --git a/src/ext/NetFx/netcoresearch/precomp.cpp b/src/ext/NetFx/netcoresearch/precomp.cpp
new file mode 100644
index 00000000..37664a1c
--- /dev/null
+++ b/src/ext/NetFx/netcoresearch/precomp.cpp
@@ -0,0 +1,3 @@
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#include "precomp.h"
diff --git a/src/ext/NetFx/netcoresearch/precomp.h b/src/ext/NetFx/netcoresearch/precomp.h
new file mode 100644
index 00000000..24023ec2
--- /dev/null
+++ b/src/ext/NetFx/netcoresearch/precomp.h
@@ -0,0 +1,18 @@
1#pragma once
2// 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.
3
4#include <windows.h>
5#include <msiquery.h>
6#include <corerror.h>
7
8#include <dutil.h>
9#include <conutil.h>
10#include <memutil.h>
11#include <pathutil.h>
12#include <strutil.h>
13#include <verutil.h>
14#include <xmlutil.h>
15
16#include <hostfxr.h>
17
18#include "netcoresearch.h"
diff --git a/src/ext/NetFx/netfx.cmd b/src/ext/NetFx/netfx.cmd
index 182630b3..65cd1dcb 100644
--- a/src/ext/NetFx/netfx.cmd
+++ b/src/ext/NetFx/netfx.cmd
@@ -2,14 +2,19 @@
2@pushd %~dp0 2@pushd %~dp0
3 3
4@set _C=Debug 4@set _C=Debug
5@set _L=%~dp0..\..\..\build\logs
5:parse_args 6:parse_args
6@if /i "%1"=="release" set _C=Release 7@if /i "%1"=="release" set _C=Release
7@if not "%1"=="" shift & goto parse_args 8@if not "%1"=="" shift & goto parse_args
8 9
9@echo NetFx.wixext build %_C% 10@echo NetFx.wixext build %_C%
10 11
12:: Restore
13nuget restore netcoresearch\packages.config || exit /b
14msbuild -t:Restore -p:Configuration=%_C% || exit /b
15
11:: Build 16:: Build
12msbuild -Restore -p:Configuration=%_C% || exit /b 17msbuild -p:Configuration=%_C% -bl:%_L%\netfx_build.binlog || exit /b
13 18
14:: Test 19:: Test
15dotnet test -c %_C% --no-build test\WixToolsetTest.Netfx || exit /b 20dotnet test -c %_C% --no-build test\WixToolsetTest.Netfx || exit /b
diff --git a/src/ext/NetFx/test/WixToolsetTest.Netfx/NetfxExtensionFixture.cs b/src/ext/NetFx/test/WixToolsetTest.Netfx/NetfxExtensionFixture.cs
index 4b8b826e..8db3db46 100644
--- a/src/ext/NetFx/test/WixToolsetTest.Netfx/NetfxExtensionFixture.cs
+++ b/src/ext/NetFx/test/WixToolsetTest.Netfx/NetfxExtensionFixture.cs
@@ -25,6 +25,8 @@ namespace WixToolsetTest.Netfx
25 { 25 {
26 "build", 26 "build",
27 Path.Combine(bundleSourceFolder, "BundleLatest.wxs"), 27 Path.Combine(bundleSourceFolder, "BundleLatest.wxs"),
28 Path.Combine(bundleSourceFolder, "NetCore3.1.12_x86.wxs"),
29 Path.Combine(bundleSourceFolder, "NetCore3.1.12_x64.wxs"),
28 "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"), 30 "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"),
29 "-ext", TestData.Get(@"WixToolset.Netfx.wixext.dll"), 31 "-ext", TestData.Get(@"WixToolset.Netfx.wixext.dll"),
30 "-intermediateFolder", intermediateFolder, 32 "-intermediateFolder", intermediateFolder,
@@ -50,6 +52,7 @@ namespace WixToolsetTest.Netfx
50 { 52 {
51 "build", 53 "build",
52 Path.Combine(bundleSourceFolder, "BundleLatest_x64.wxs"), 54 Path.Combine(bundleSourceFolder, "BundleLatest_x64.wxs"),
55 Path.Combine(bundleSourceFolder, "NetCore3.1.12_x64.wxs"),
53 "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"), 56 "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"),
54 "-ext", TestData.Get(@"WixToolset.Netfx.wixext.dll"), 57 "-ext", TestData.Get(@"WixToolset.Netfx.wixext.dll"),
55 "-intermediateFolder", intermediateFolder, 58 "-intermediateFolder", intermediateFolder,
diff --git a/src/ext/NetFx/test/WixToolsetTest.Netfx/TestData/UsingDotNetCorePackages/BundleLatest.wxs b/src/ext/NetFx/test/WixToolsetTest.Netfx/TestData/UsingDotNetCorePackages/BundleLatest.wxs
index 8e3d2c30..b7b55747 100644
--- a/src/ext/NetFx/test/WixToolsetTest.Netfx/TestData/UsingDotNetCorePackages/BundleLatest.wxs
+++ b/src/ext/NetFx/test/WixToolsetTest.Netfx/TestData/UsingDotNetCorePackages/BundleLatest.wxs
@@ -1,12 +1,15 @@
1<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal"> 1<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal">
2 <Bundle Name="WixStdBa" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="75D5D534-E177-4689-AAE9-CAC1C39002C2"> 2 <Bundle Name="WixStdBa" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="75D5D534-E177-4689-AAE9-CAC1C39002C2">
3 <BootstrapperApplication> 3 <BootstrapperApplication>
4 <bal:WixStandardBootstrapperApplication LicenseUrl="http://wixtoolset.org/about/license/" Theme="hyperlinkLicense" /> 4 <bal:WixStandardBootstrapperApplication LicenseUrl="http://wixtoolset.org/about/license/" Theme="hyperlinkLicense" />
5 </BootstrapperApplication> 5 </BootstrapperApplication>
6 <Chain> 6 <Chain>
7 <PackageGroupRef Id="AspNetCoreRuntime31Redist_x86" /> 7 <PackageGroupRef Id="AspNetCoreRuntime3112Redist_x86" />
8 <PackageGroupRef Id="DesktopNetCoreRuntime31Redist_x86" /> 8 <PackageGroupRef Id="DesktopNetCoreRuntime3112Redist_x86" />
9 <PackageGroupRef Id="DotNetCoreRuntime31Redist_x86" /> 9 <PackageGroupRef Id="DotNetCoreRuntime3112Redist_x86" />
10 <PackageGroupRef Id="AspNetCoreRuntime3112Redist_x64" />
11 <PackageGroupRef Id="DesktopNetCoreRuntime3112Redist_x64" />
12 <PackageGroupRef Id="DotNetCoreRuntime3112Redist_x64" />
10 </Chain> 13 </Chain>
11 </Bundle> 14 </Bundle>
12</Wix> 15</Wix>
diff --git a/src/ext/NetFx/test/WixToolsetTest.Netfx/TestData/UsingDotNetCorePackages/BundleLatest_x64.wxs b/src/ext/NetFx/test/WixToolsetTest.Netfx/TestData/UsingDotNetCorePackages/BundleLatest_x64.wxs
index fc42ac99..3588686a 100644
--- a/src/ext/NetFx/test/WixToolsetTest.Netfx/TestData/UsingDotNetCorePackages/BundleLatest_x64.wxs
+++ b/src/ext/NetFx/test/WixToolsetTest.Netfx/TestData/UsingDotNetCorePackages/BundleLatest_x64.wxs
@@ -1,12 +1,12 @@
1<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal"> 1<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal">
2 <Bundle Name="WixStdBa" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="75D5D534-E177-4689-AAE9-CAC1C39002C2"> 2 <Bundle Name="WixStdBa" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="75D5D534-E177-4689-AAE9-CAC1C39002C2">
3 <BootstrapperApplication> 3 <BootstrapperApplication>
4 <bal:WixStandardBootstrapperApplication LicenseUrl="http://wixtoolset.org/about/license/" Theme="hyperlinkLicense" /> 4 <bal:WixStandardBootstrapperApplication LicenseUrl="http://wixtoolset.org/about/license/" Theme="hyperlinkLicense" />
5 </BootstrapperApplication> 5 </BootstrapperApplication>
6 <Chain> 6 <Chain>
7 <PackageGroupRef Id="AspNetCoreRuntime31Redist_x64" /> 7 <PackageGroupRef Id="AspNetCoreRuntime3112Redist_x64" />
8 <PackageGroupRef Id="DesktopNetCoreRuntime31Redist_x64" /> 8 <PackageGroupRef Id="DesktopNetCoreRuntime3112Redist_x64" />
9 <PackageGroupRef Id="DotNetCoreRuntime31Redist_x64" /> 9 <PackageGroupRef Id="DotNetCoreRuntime3112Redist_x64" />
10 </Chain> 10 </Chain>
11 </Bundle> 11 </Bundle>
12</Wix> 12</Wix>
diff --git a/src/ext/NetFx/wixlib/NetCore3.1.12_x64.wxs b/src/ext/NetFx/test/WixToolsetTest.Netfx/TestData/UsingDotNetCorePackages/NetCore3.1.12_x64.wxs
index 3a1f5910..20b266a5 100644
--- a/src/ext/NetFx/wixlib/NetCore3.1.12_x64.wxs
+++ b/src/ext/NetFx/test/WixToolsetTest.Netfx/TestData/UsingDotNetCorePackages/NetCore3.1.12_x64.wxs
@@ -1,6 +1,6 @@
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. --> 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 2
3<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util"> 3<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:netfx="http://wixtoolset.org/schemas/v4/wxs/netfx">
4 4
5 <?define NetCorePlatform = x64?> 5 <?define NetCorePlatform = x64?>
6 <?define NetCoreIdVersion = 3112?> 6 <?define NetCoreIdVersion = 3112?>
@@ -12,9 +12,9 @@
12 <?define DotNetCoreRedistLink = https://download.visualstudio.microsoft.com/download/pr/2fdc3009-cf5c-4cf6-8f3b-a61e83200cbb/2c71ee04b48103a7464f4e28a8bf339b/dotnet-runtime-3.1.12-win-x64.exe?> 12 <?define DotNetCoreRedistLink = https://download.visualstudio.microsoft.com/download/pr/2fdc3009-cf5c-4cf6-8f3b-a61e83200cbb/2c71ee04b48103a7464f4e28a8bf339b/dotnet-runtime-3.1.12-win-x64.exe?>
13 13
14 <Fragment> 14 <Fragment>
15 <util:DirectorySearchRef Id="$(var.AspNetCoreId)" /> 15 <netfx:DotNetCoreSearch Id="$(var.AspNetCoreId)" RuntimeType="aspnet" Platform="$(var.NetCorePlatform)" MajorVersion="3" Variable="$(var.AspNetCoreId)" />
16 16
17 <WixVariable Id="AspNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)DetectCondition" Value="$(var.AspNetCoreId)" Overridable="yes" /> 17 <WixVariable Id="AspNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)DetectCondition" Value="$(var.AspNetCoreId) &gt;= v$(var.NetCoreVersion)" Overridable="yes" />
18 <WixVariable Id="AspNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)InstallCondition" Value="" Overridable="yes" /> 18 <WixVariable Id="AspNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)InstallCondition" Value="" Overridable="yes" />
19 <WixVariable Id="AspNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)PackageDirectory" Value="redist\" Overridable="yes" /> 19 <WixVariable Id="AspNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)PackageDirectory" Value="redist\" Overridable="yes" />
20 <WixVariable Id="AspNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)RepairArguments" Value="" Overridable="yes" /> 20 <WixVariable Id="AspNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)RepairArguments" Value="" Overridable="yes" />
@@ -27,9 +27,9 @@
27 </Fragment> 27 </Fragment>
28 28
29 <Fragment> 29 <Fragment>
30 <util:DirectorySearchRef Id="$(var.DesktopNetCoreId)" /> 30 <netfx:DotNetCoreSearch Id="$(var.DesktopNetCoreId)" RuntimeType="desktop" Platform="$(var.NetCorePlatform)" MajorVersion="3" Variable="$(var.DesktopNetCoreId)" />
31 31
32 <WixVariable Id="DesktopNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)DetectCondition" Value="$(var.DesktopNetCoreId)" Overridable="yes" /> 32 <WixVariable Id="DesktopNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)DetectCondition" Value="$(var.DesktopNetCoreId) &gt;= v$(var.NetCoreVersion)" Overridable="yes" />
33 <WixVariable Id="DesktopNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)InstallCondition" Value="" Overridable="yes" /> 33 <WixVariable Id="DesktopNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)InstallCondition" Value="" Overridable="yes" />
34 <WixVariable Id="DesktopNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)PackageDirectory" Value="redist\" Overridable="yes" /> 34 <WixVariable Id="DesktopNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)PackageDirectory" Value="redist\" Overridable="yes" />
35 <WixVariable Id="DesktopNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)RepairArguments" Value="" Overridable="yes" /> 35 <WixVariable Id="DesktopNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)RepairArguments" Value="" Overridable="yes" />
@@ -42,9 +42,9 @@
42 </Fragment> 42 </Fragment>
43 43
44 <Fragment> 44 <Fragment>
45 <util:DirectorySearchRef Id="$(var.DotNetCoreId)" /> 45 <netfx:DotNetCoreSearch Id="$(var.DotNetCoreId)" RuntimeType="core" Platform="$(var.NetCorePlatform)" MajorVersion="3" Variable="$(var.DotNetCoreId)" />
46 46
47 <WixVariable Id="DotNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)DetectCondition" Value="$(var.DotNetCoreId)" Overridable="yes" /> 47 <WixVariable Id="DotNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)DetectCondition" Value="$(var.DotNetCoreId) &gt;= v$(var.NetCoreVersion)" Overridable="yes" />
48 <WixVariable Id="DotNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)InstallCondition" Value="" Overridable="yes" /> 48 <WixVariable Id="DotNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)InstallCondition" Value="" Overridable="yes" />
49 <WixVariable Id="DotNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)PackageDirectory" Value="redist\" Overridable="yes" /> 49 <WixVariable Id="DotNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)PackageDirectory" Value="redist\" Overridable="yes" />
50 <WixVariable Id="DotNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)RepairArguments" Value="" Overridable="yes" /> 50 <WixVariable Id="DotNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)RepairArguments" Value="" Overridable="yes" />
diff --git a/src/ext/NetFx/wixlib/NetCore3.1.12_x86.wxs b/src/ext/NetFx/test/WixToolsetTest.Netfx/TestData/UsingDotNetCorePackages/NetCore3.1.12_x86.wxs
index e3a70daf..4bd97492 100644
--- a/src/ext/NetFx/wixlib/NetCore3.1.12_x86.wxs
+++ b/src/ext/NetFx/test/WixToolsetTest.Netfx/TestData/UsingDotNetCorePackages/NetCore3.1.12_x86.wxs
@@ -1,6 +1,6 @@
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. --> 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 2
3<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util"> 3<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:netfx="http://wixtoolset.org/schemas/v4/wxs/netfx">
4 4
5 <?define NetCorePlatform = x86?> 5 <?define NetCorePlatform = x86?>
6 <?define NetCoreIdVersion = 3112?> 6 <?define NetCoreIdVersion = 3112?>
@@ -12,9 +12,9 @@
12 <?define DotNetCoreRedistLink = https://download.visualstudio.microsoft.com/download/pr/cbdd1603-7fa9-4957-8869-94e24963ba6c/ca0b7d1be494882d5a7433accfa3c94c/dotnet-runtime-3.1.12-win-x86.exe?> 12 <?define DotNetCoreRedistLink = https://download.visualstudio.microsoft.com/download/pr/cbdd1603-7fa9-4957-8869-94e24963ba6c/ca0b7d1be494882d5a7433accfa3c94c/dotnet-runtime-3.1.12-win-x86.exe?>
13 13
14 <Fragment> 14 <Fragment>
15 <util:DirectorySearchRef Id="$(var.AspNetCoreId)" /> 15 <netfx:DotNetCoreSearch Id="$(var.AspNetCoreId)" RuntimeType="aspnet" Platform="$(var.NetCorePlatform)" MajorVersion="3" Variable="$(var.AspNetCoreId)" />
16 16
17 <WixVariable Id="AspNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)DetectCondition" Value="$(var.AspNetCoreId)" Overridable="yes" /> 17 <WixVariable Id="AspNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)DetectCondition" Value="$(var.AspNetCoreId) &gt;= v$(var.NetCoreVersion)" Overridable="yes" />
18 <WixVariable Id="AspNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)InstallCondition" Value="" Overridable="yes" /> 18 <WixVariable Id="AspNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)InstallCondition" Value="" Overridable="yes" />
19 <WixVariable Id="AspNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)PackageDirectory" Value="redist\" Overridable="yes" /> 19 <WixVariable Id="AspNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)PackageDirectory" Value="redist\" Overridable="yes" />
20 <WixVariable Id="AspNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)RepairArguments" Value="" Overridable="yes" /> 20 <WixVariable Id="AspNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)RepairArguments" Value="" Overridable="yes" />
@@ -27,9 +27,9 @@
27 </Fragment> 27 </Fragment>
28 28
29 <Fragment> 29 <Fragment>
30 <util:DirectorySearchRef Id="$(var.DesktopNetCoreId)" /> 30 <netfx:DotNetCoreSearch Id="$(var.DesktopNetCoreId)" RuntimeType="desktop" Platform="$(var.NetCorePlatform)" MajorVersion="3" Variable="$(var.DesktopNetCoreId)" />
31 31
32 <WixVariable Id="DesktopNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)DetectCondition" Value="$(var.DesktopNetCoreId)" Overridable="yes" /> 32 <WixVariable Id="DesktopNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)DetectCondition" Value="$(var.DesktopNetCoreId) &gt;= v$(var.NetCoreVersion)" Overridable="yes" />
33 <WixVariable Id="DesktopNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)InstallCondition" Value="" Overridable="yes" /> 33 <WixVariable Id="DesktopNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)InstallCondition" Value="" Overridable="yes" />
34 <WixVariable Id="DesktopNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)PackageDirectory" Value="redist\" Overridable="yes" /> 34 <WixVariable Id="DesktopNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)PackageDirectory" Value="redist\" Overridable="yes" />
35 <WixVariable Id="DesktopNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)RepairArguments" Value="" Overridable="yes" /> 35 <WixVariable Id="DesktopNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)RepairArguments" Value="" Overridable="yes" />
@@ -42,9 +42,9 @@
42 </Fragment> 42 </Fragment>
43 43
44 <Fragment> 44 <Fragment>
45 <util:DirectorySearchRef Id="$(var.DotNetCoreId)" /> 45 <netfx:DotNetCoreSearch Id="$(var.DotNetCoreId)" RuntimeType="core" Platform="$(var.NetCorePlatform)" MajorVersion="3" Variable="$(var.DotNetCoreId)" />
46 46
47 <WixVariable Id="DotNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)DetectCondition" Value="$(var.DotNetCoreId)" Overridable="yes" /> 47 <WixVariable Id="DotNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)DetectCondition" Value="$(var.DotNetCoreId) &gt;= v$(var.NetCoreVersion)" Overridable="yes" />
48 <WixVariable Id="DotNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)InstallCondition" Value="" Overridable="yes" /> 48 <WixVariable Id="DotNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)InstallCondition" Value="" Overridable="yes" />
49 <WixVariable Id="DotNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)PackageDirectory" Value="redist\" Overridable="yes" /> 49 <WixVariable Id="DotNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)PackageDirectory" Value="redist\" Overridable="yes" />
50 <WixVariable Id="DotNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)RepairArguments" Value="" Overridable="yes" /> 50 <WixVariable Id="DotNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)RepairArguments" Value="" Overridable="yes" />
diff --git a/src/ext/NetFx/wixlib/NetCore3_Platform.wxi b/src/ext/NetFx/test/WixToolsetTest.Netfx/TestData/UsingDotNetCorePackages/NetCore3_Platform.wxi
index 88e672be..f0b97d33 100644
--- a/src/ext/NetFx/wixlib/NetCore3_Platform.wxi
+++ b/src/ext/NetFx/test/WixToolsetTest.Netfx/TestData/UsingDotNetCorePackages/NetCore3_Platform.wxi
@@ -1,45 +1,29 @@
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. --> 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 2
3 3
4<Include 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<Include 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">
5 5
6 <?define AspNetCoreId = ASPNETCORERUNTIME$(var.NetCoreIdVersion)_$(var.NetCorePlatform)?> 6 <?define AspNetCoreId = ASPNETCORERUNTIME3_$(var.NetCorePlatform)?>
7 <?define AspNetCoreRedistId = AspNetCoreRuntime$(var.NetCoreIdVersion)Redist_$(var.NetCorePlatform)?> 7 <?define AspNetCoreRedistId = AspNetCoreRuntime$(var.NetCoreIdVersion)Redist_$(var.NetCorePlatform)?>
8 <?define AspNetCoreRedistLog = AspNetCoreRuntime$(var.NetCoreIdVersion)RedistLog?> 8 <?define AspNetCoreRedistLog = AspNetCoreRuntime$(var.NetCoreIdVersion)RedistLog?>
9 <?define AspNetCoreRedistInstallArguments = /install /quiet /log &quot;[$(var.AspNetCoreRedistLog)]&quot;?> 9 <?define AspNetCoreRedistInstallArguments = /install /quiet /log "[$(var.AspNetCoreRedistLog)]"?>
10 <?define AspNetCoreRedistUninstallArguments = /uninstall /quiet /log &quot;[$(var.AspNetCoreRedistLog)]&quot;?> 10 <?define AspNetCoreRedistUninstallArguments = /uninstall /quiet /log "[$(var.AspNetCoreRedistLog)]"?>
11 11
12 <?define DesktopNetCoreId = DESKTOPNETCORERUNTIME$(var.NetCoreIdVersion)_$(var.NetCorePlatform)?> 12 <?define DesktopNetCoreId = DESKTOPNETCORERUNTIME3_$(var.NetCorePlatform)?>
13 <?define DesktopNetCoreRedistId = DesktopNetCoreRuntime$(var.NetCoreIdVersion)Redist_$(var.NetCorePlatform)?> 13 <?define DesktopNetCoreRedistId = DesktopNetCoreRuntime$(var.NetCoreIdVersion)Redist_$(var.NetCorePlatform)?>
14 <?define DesktopNetCoreRedistLog = DesktopNetCoreRuntime$(var.NetCoreIdVersion)RedistLog?> 14 <?define DesktopNetCoreRedistLog = DesktopNetCoreRuntime$(var.NetCoreIdVersion)RedistLog?>
15 <?define DesktopNetCoreRedistInstallArguments = /install /quiet /log &quot;[$(var.DesktopNetCoreRedistLog)]&quot;?> 15 <?define DesktopNetCoreRedistInstallArguments = /install /quiet /log "[$(var.DesktopNetCoreRedistLog)]"?>
16 <?define DesktopNetCoreRedistUninstallArguments = /uninstall /quiet /log &quot;[$(var.DesktopNetCoreRedistLog)]&quot;?> 16 <?define DesktopNetCoreRedistUninstallArguments = /uninstall /quiet /log "[$(var.DesktopNetCoreRedistLog)]"?>
17 17
18 <?define DotNetCoreId = DOTNETCORERUNTIME$(var.NetCoreIdVersion)_$(var.NetCorePlatform)?> 18 <?define DotNetCoreId = DOTNETCORERUNTIME3_$(var.NetCorePlatform)?>
19 <?define DotNetCoreRedistId = DotNetCoreRuntime$(var.NetCoreIdVersion)Redist_$(var.NetCorePlatform)?> 19 <?define DotNetCoreRedistId = DotNetCoreRuntime$(var.NetCoreIdVersion)Redist_$(var.NetCorePlatform)?>
20 <?define DotNetCoreRedistLog = DotNetCoreRuntime$(var.NetCoreIdVersion)RedistLog?> 20 <?define DotNetCoreRedistLog = DotNetCoreRuntime$(var.NetCoreIdVersion)RedistLog?>
21 <?define DotNetCoreRedistInstallArguments = /install /quiet /log &quot;[$(var.DotNetCoreRedistLog)]&quot;?> 21 <?define DotNetCoreRedistInstallArguments = /install /quiet /log "[$(var.DotNetCoreRedistLog)]"?>
22 <?define DotNetCoreRedistUninstallArguments = /uninstall /quiet /log &quot;[$(var.DotNetCoreRedistLog)]&quot;?> 22 <?define DotNetCoreRedistUninstallArguments = /uninstall /quiet /log "[$(var.DotNetCoreRedistLog)]"?>
23 23
24 <?define DotNetHomeId = DOTNETHOME_$(var.NetCorePlatform)?>
25 <?define NetCoreEulaLink = https://go.microsoft.com/fwlink/?LinkId=329770?> 24 <?define NetCoreEulaLink = https://go.microsoft.com/fwlink/?LinkId=329770?>
26 25
27 <Fragment> 26 <Fragment>
28 <util:RegistrySearchRef Id="$(var.DotNetHomeId)" />
29 <util:DirectorySearch Id="$(var.AspNetCoreId)" Variable="$(var.AspNetCoreId)" Path="[$(var.DotNetHomeId)]\shared\Microsoft.AspNetCore.App\$(var.NetCoreVersion)" Result="exists" After="$(var.DotNetHomeId)" />
30 </Fragment>
31
32 <Fragment>
33 <util:RegistrySearchRef Id="$(var.DotNetHomeId)" />
34 <util:DirectorySearch Id="$(var.DesktopNetCoreId)" Variable="$(var.DesktopNetCoreId)" Path="[$(var.DotNetHomeId)]\shared\Microsoft.WindowsDesktop.App\$(var.NetCoreVersion)" Result="exists" After="$(var.DotNetHomeId)" />
35 </Fragment>
36
37 <Fragment>
38 <util:RegistrySearchRef Id="$(var.DotNetHomeId)" />
39 <util:DirectorySearch Id="$(var.DotNetCoreId)" Variable="$(var.DotNetCoreId)" Path="[$(var.DotNetHomeId)]\shared\Microsoft.NETCore.App\$(var.NetCoreVersion)" Result="exists" After="$(var.DotNetHomeId)" />
40 </Fragment>
41
42 <Fragment>
43 <PackageGroup Id="$(var.AspNetCoreRedistId)AsPrereq"> 27 <PackageGroup Id="$(var.AspNetCoreRedistId)AsPrereq">
44 <PackageGroupRef Id="$(var.AspNetCoreRedistId)" /> 28 <PackageGroupRef Id="$(var.AspNetCoreRedistId)" />
45 </PackageGroup> 29 </PackageGroup>
diff --git a/src/ext/NetFx/wixext/NetFxCompiler.cs b/src/ext/NetFx/wixext/NetFxCompiler.cs
index 90aa8bcb..739618e9 100644
--- a/src/ext/NetFx/wixext/NetFxCompiler.cs
+++ b/src/ext/NetFx/wixext/NetFxCompiler.cs
@@ -40,12 +40,178 @@ namespace WixToolset.Netfx
40 break; 40 break;
41 } 41 }
42 break; 42 break;
43 case "Bundle":
44 case "Fragment":
45 switch (element.Name.LocalName)
46 {
47 case "DotNetCoreSearch":
48 this.ParseDotNetCoreSearchElement(intermediate, section, element);
49 break;
50 case "DotNetCoreSearchRef":
51 this.ParseDotNetCoreSearchRefElement(intermediate, section, element);
52 break;
53 }
54
55 break;
43 default: 56 default:
44 this.ParseHelper.UnexpectedElement(parentElement, element); 57 this.ParseHelper.UnexpectedElement(parentElement, element);
45 break; 58 break;
46 } 59 }
47 } 60 }
48 61
62 private void ParseDotNetCoreSearchElement(Intermediate intermediate, IntermediateSection section, XElement element)
63 {
64 var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element);
65 Identifier id = null;
66 string variable = null;
67 string condition = null;
68 string after = null;
69 NetCoreSearchRuntimeType? runtimeType = null;
70 NetCoreSearchPlatform? platform = null;
71 var majorVersion = CompilerConstants.IntegerNotSet;
72
73 foreach (var attrib in element.Attributes())
74 {
75 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace)
76 {
77 switch (attrib.Name.LocalName)
78 {
79 case "Id":
80 id = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib);
81 break;
82 case "Variable":
83 variable = this.ParseHelper.GetAttributeBundleVariableNameValue(sourceLineNumbers, attrib);
84 break;
85 case "Condition":
86 condition = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
87 break;
88 case "After":
89 after = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
90 break;
91 case "RuntimeType":
92 var runtimeTypeValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
93 switch (runtimeTypeValue)
94 {
95 case "aspnet":
96 runtimeType = NetCoreSearchRuntimeType.Aspnet;
97 break;
98 case "core":
99 runtimeType = NetCoreSearchRuntimeType.Core;
100 break;
101 case "desktop":
102 runtimeType = NetCoreSearchRuntimeType.Desktop;
103 break;
104 default:
105 this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, element.Name.LocalName, "RuntimeType", runtimeTypeValue, "aspnet", "core", "desktop"));
106 break;
107 }
108 break;
109 case "Platform":
110 var platformValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
111 switch (platformValue)
112 {
113 case "arm64":
114 platform = NetCoreSearchPlatform.Arm64;
115 break;
116 case "x64":
117 platform = NetCoreSearchPlatform.X64;
118 break;
119 case "x86":
120 platform = NetCoreSearchPlatform.X86;
121 break;
122 default:
123 this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, element.Name.LocalName, "Platform", platformValue, "arm64", "x64", "x86"));
124 break;
125 }
126 break;
127 case "MajorVersion":
128 // .NET Core had a different deployment strategy before .NET Core 3.0 which would require different detection logic.
129 majorVersion = this.ParseHelper.GetAttributeIntegerValue(sourceLineNumbers, attrib, 3, Int32.MaxValue);
130 break;
131 default:
132 this.ParseHelper.UnexpectedAttribute(element, attrib);
133 break;
134 }
135 }
136 else
137 {
138 this.ParseHelper.ParseExtensionAttribute(this.Context.Extensions, intermediate, section, element, attrib);
139 }
140 }
141
142 if (id == null)
143 {
144 id = this.ParseHelper.CreateIdentifier("dncs", variable, condition, after);
145 }
146
147 if (!runtimeType.HasValue)
148 {
149 this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "RuntimeType"));
150 }
151
152 if (!platform.HasValue)
153 {
154 this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Platform"));
155 }
156
157 if (majorVersion == CompilerConstants.IntegerNotSet)
158 {
159 this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "MajorVersion"));
160 }
161 else if (majorVersion == 4)
162 {
163 this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, element.Name.LocalName, "MajorVersion", "4", "3", "5+"));
164 }
165
166 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element);
167
168 var bundleExtensionId = this.ParseHelper.CreateIdentifierValueFromPlatform("Wix4NetfxBundleExtension", this.Context.Platform, BurnPlatforms.X86 | BurnPlatforms.X64 | BurnPlatforms.ARM64);
169 if (bundleExtensionId == null)
170 {
171 this.Messaging.Write(ErrorMessages.UnsupportedPlatformForElement(sourceLineNumbers, this.Context.Platform.ToString(), element.Name.LocalName));
172 }
173
174 if (!this.Messaging.EncounteredError)
175 {
176 this.ParseHelper.CreateWixSearchSymbol(section, sourceLineNumbers, element.Name.LocalName, id, variable, condition, after, bundleExtensionId);
177
178 section.AddSymbol(new NetFxNetCoreSearchSymbol(sourceLineNumbers, id)
179 {
180 RuntimeType = runtimeType.Value,
181 Platform = platform.Value,
182 MajorVersion = majorVersion,
183 });
184 }
185 }
186
187 private void ParseDotNetCoreSearchRefElement(Intermediate intermediate, IntermediateSection section, XElement element)
188 {
189 var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element);
190
191 foreach (var attrib in element.Attributes())
192 {
193 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace)
194 {
195 switch (attrib.Name.LocalName)
196 {
197 case "Id":
198 var refId = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
199 this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, NetfxSymbolDefinitions.NetFxNetCoreSearch, refId);
200 break;
201 default:
202 this.ParseHelper.UnexpectedAttribute(element, attrib);
203 break;
204 }
205 }
206 else
207 {
208 this.ParseHelper.ParseExtensionAttribute(this.Context.Extensions, intermediate, section, element, attrib);
209 }
210 }
211
212 this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element);
213 }
214
49 /// <summary> 215 /// <summary>
50 /// Parses a NativeImage element. 216 /// Parses a NativeImage element.
51 /// </summary> 217 /// </summary>
diff --git a/src/ext/NetFx/wixext/NetFxExtensionData.cs b/src/ext/NetFx/wixext/NetFxExtensionData.cs
index 0a24ef1e..61d618cf 100644
--- a/src/ext/NetFx/wixext/NetFxExtensionData.cs
+++ b/src/ext/NetFx/wixext/NetFxExtensionData.cs
@@ -4,7 +4,6 @@ namespace WixToolset.Netfx
4{ 4{
5 using WixToolset.Data; 5 using WixToolset.Data;
6 using WixToolset.Extensibility; 6 using WixToolset.Extensibility;
7 using WixToolset.Netfx.Symbols;
8 7
9 /// <summary> 8 /// <summary>
10 /// The WiX Toolset .NET Framework Extension. 9 /// The WiX Toolset .NET Framework Extension.
@@ -13,7 +12,7 @@ namespace WixToolset.Netfx
13 { 12 {
14 public override bool TryGetSymbolDefinitionByName(string name, out IntermediateSymbolDefinition symbolDefinition) 13 public override bool TryGetSymbolDefinitionByName(string name, out IntermediateSymbolDefinition symbolDefinition)
15 { 14 {
16 symbolDefinition = (name == NetfxSymbolDefinitionNames.NetFxNativeImage) ? NetfxSymbolDefinitions.NetFxNativeImage : null; 15 symbolDefinition = NetfxSymbolDefinitions.ByName(name);
17 return symbolDefinition != null; 16 return symbolDefinition != null;
18 } 17 }
19 18
diff --git a/src/ext/NetFx/wixext/Symbols/NetFxNativeImageSymbol.cs b/src/ext/NetFx/wixext/Symbols/NetFxNativeImageSymbol.cs
index 3803abd6..252c6aba 100644
--- a/src/ext/NetFx/wixext/Symbols/NetFxNativeImageSymbol.cs
+++ b/src/ext/NetFx/wixext/Symbols/NetFxNativeImageSymbol.cs
@@ -1,5 +1,26 @@
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. 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 2
3namespace WixToolset.Netfx
4{
5 using WixToolset.Data;
6 using WixToolset.Netfx.Symbols;
7
8 public static partial class NetfxSymbolDefinitions
9 {
10 public static readonly IntermediateSymbolDefinition NetFxNativeImage = new IntermediateSymbolDefinition(
11 NetfxSymbolDefinitionType.NetFxNativeImage.ToString(),
12 new[]
13 {
14 new IntermediateFieldDefinition(nameof(NetFxNativeImageSymbolFields.FileRef), IntermediateFieldType.String),
15 new IntermediateFieldDefinition(nameof(NetFxNativeImageSymbolFields.Priority), IntermediateFieldType.Number),
16 new IntermediateFieldDefinition(nameof(NetFxNativeImageSymbolFields.Attributes), IntermediateFieldType.Number),
17 new IntermediateFieldDefinition(nameof(NetFxNativeImageSymbolFields.ApplicationFileRef), IntermediateFieldType.String),
18 new IntermediateFieldDefinition(nameof(NetFxNativeImageSymbolFields.ApplicationBaseDirectoryRef), IntermediateFieldType.String),
19 },
20 typeof(NetFxNativeImageSymbol));
21 }
22}
23
3namespace WixToolset.Netfx.Symbols 24namespace WixToolset.Netfx.Symbols
4{ 25{
5 using WixToolset.Data; 26 using WixToolset.Data;
@@ -55,4 +76,4 @@ namespace WixToolset.Netfx.Symbols
55 set => this.Set((int)NetFxNativeImageSymbolFields.ApplicationBaseDirectoryRef, value); 76 set => this.Set((int)NetFxNativeImageSymbolFields.ApplicationBaseDirectoryRef, value);
56 } 77 }
57 } 78 }
58} \ No newline at end of file 79}
diff --git a/src/ext/NetFx/wixext/Symbols/NetFxNetCoreSearchSymbol.cs b/src/ext/NetFx/wixext/Symbols/NetFxNetCoreSearchSymbol.cs
new file mode 100644
index 00000000..8bf0a24c
--- /dev/null
+++ b/src/ext/NetFx/wixext/Symbols/NetFxNetCoreSearchSymbol.cs
@@ -0,0 +1,77 @@
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
3namespace WixToolset.Netfx
4{
5 using WixToolset.Data;
6 using WixToolset.Netfx.Symbols;
7
8 public static partial class NetfxSymbolDefinitions
9 {
10 public static readonly IntermediateSymbolDefinition NetFxNetCoreSearch = new IntermediateSymbolDefinition(
11 NetfxSymbolDefinitionType.NetFxNetCoreSearch.ToString(),
12 new[]
13 {
14 new IntermediateFieldDefinition(nameof(NetFxNetCoreSearchSymbolFields.RuntimeType), IntermediateFieldType.Number),
15 new IntermediateFieldDefinition(nameof(NetFxNetCoreSearchSymbolFields.Platform), IntermediateFieldType.Number),
16 new IntermediateFieldDefinition(nameof(NetFxNetCoreSearchSymbolFields.MajorVersion), IntermediateFieldType.Number),
17 },
18 typeof(NetFxNetCoreSearchSymbol));
19 }
20}
21
22namespace WixToolset.Netfx.Symbols
23{
24 using WixToolset.Data;
25
26 public enum NetCoreSearchRuntimeType
27 {
28 Core,
29 Aspnet,
30 Desktop,
31 }
32
33 public enum NetCoreSearchPlatform
34 {
35 X86,
36 X64,
37 Arm64,
38 }
39
40 public enum NetFxNetCoreSearchSymbolFields
41 {
42 RuntimeType,
43 Platform,
44 MajorVersion,
45 }
46
47 public class NetFxNetCoreSearchSymbol : IntermediateSymbol
48 {
49 public NetFxNetCoreSearchSymbol() : base(NetfxSymbolDefinitions.NetFxNetCoreSearch, null, null)
50 {
51 }
52
53 public NetFxNetCoreSearchSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(NetfxSymbolDefinitions.NetFxNetCoreSearch, sourceLineNumber, id)
54 {
55 }
56
57 public IntermediateField this[NetFxNetCoreSearchSymbolFields index] => this.Fields[(int)index];
58
59 public NetCoreSearchRuntimeType RuntimeType
60 {
61 get => (NetCoreSearchRuntimeType)this.Fields[(int)NetFxNetCoreSearchSymbolFields.RuntimeType].AsNumber();
62 set => this.Set((int)NetFxNetCoreSearchSymbolFields.RuntimeType, (int)value);
63 }
64
65 public NetCoreSearchPlatform Platform
66 {
67 get => (NetCoreSearchPlatform)this.Fields[(int)NetFxNetCoreSearchSymbolFields.Platform].AsNumber();
68 set => this.Set((int)NetFxNetCoreSearchSymbolFields.Platform, (int)value);
69 }
70
71 public int MajorVersion
72 {
73 get => this.Fields[(int)NetFxNetCoreSearchSymbolFields.MajorVersion].AsNumber();
74 set => this.Set((int)NetFxNetCoreSearchSymbolFields.MajorVersion, value);
75 }
76 }
77}
diff --git a/src/ext/NetFx/wixext/Symbols/NetfxSymbolDefinitions.cs b/src/ext/NetFx/wixext/Symbols/NetfxSymbolDefinitions.cs
index 3c0f1176..862eba16 100644
--- a/src/ext/NetFx/wixext/Symbols/NetfxSymbolDefinitions.cs
+++ b/src/ext/NetFx/wixext/Symbols/NetfxSymbolDefinitions.cs
@@ -1,26 +1,47 @@
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. 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 2
3namespace WixToolset.Netfx.Symbols 3namespace WixToolset.Netfx
4{ 4{
5 using System;
5 using WixToolset.Data; 6 using WixToolset.Data;
7 using WixToolset.Data.Burn;
6 8
7 public static class NetfxSymbolDefinitionNames 9 public enum NetfxSymbolDefinitionType
8 { 10 {
9 public static string NetFxNativeImage { get; } = "NetFxNativeImage"; 11 NetFxNativeImage,
12 NetFxNetCoreSearch,
10 } 13 }
11 14
12 public static class NetfxSymbolDefinitions 15 public static partial class NetfxSymbolDefinitions
13 { 16 {
14 public static readonly IntermediateSymbolDefinition NetFxNativeImage = new IntermediateSymbolDefinition( 17 public static IntermediateSymbolDefinition ByName(string name)
15 NetfxSymbolDefinitionNames.NetFxNativeImage, 18 {
16 new[] 19 if (!Enum.TryParse(name, out NetfxSymbolDefinitionType type))
17 { 20 {
18 new IntermediateFieldDefinition(nameof(NetFxNativeImageSymbolFields.FileRef), IntermediateFieldType.String), 21 return null;
19 new IntermediateFieldDefinition(nameof(NetFxNativeImageSymbolFields.Priority), IntermediateFieldType.Number), 22 }
20 new IntermediateFieldDefinition(nameof(NetFxNativeImageSymbolFields.Attributes), IntermediateFieldType.Number), 23
21 new IntermediateFieldDefinition(nameof(NetFxNativeImageSymbolFields.ApplicationFileRef), IntermediateFieldType.String), 24 return ByType(type);
22 new IntermediateFieldDefinition(nameof(NetFxNativeImageSymbolFields.ApplicationBaseDirectoryRef), IntermediateFieldType.String), 25 }
23 }, 26
24 typeof(NetFxNativeImageSymbol)); 27 public static IntermediateSymbolDefinition ByType(NetfxSymbolDefinitionType type)
28 {
29 switch (type)
30 {
31 case NetfxSymbolDefinitionType.NetFxNativeImage:
32 return NetfxSymbolDefinitions.NetFxNativeImage;
33
34 case NetfxSymbolDefinitionType.NetFxNetCoreSearch:
35 return NetfxSymbolDefinitions.NetFxNetCoreSearch;
36
37 default:
38 throw new ArgumentOutOfRangeException(nameof(type));
39 }
40 }
41
42 static NetfxSymbolDefinitions()
43 {
44 NetFxNetCoreSearch.AddTag(BurnConstants.BundleExtensionSearchSymbolDefinitionTag);
45 }
25 } 46 }
26} 47}
diff --git a/src/ext/NetFx/wixlib/NetCore3.1_x64.wxs b/src/ext/NetFx/wixlib/NetCore3.1_x64.wxs
deleted file mode 100644
index 60d7c27f..00000000
--- a/src/ext/NetFx/wixlib/NetCore3.1_x64.wxs
+++ /dev/null
@@ -1,22 +0,0 @@
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">
4
5 <Fragment>
6 <PackageGroup Id="AspNetCoreRuntime31Redist_x64">
7 <PackageGroupRef Id="AspNetCoreRuntime3112Redist_x64" />
8 </PackageGroup>
9 </Fragment>
10
11 <Fragment>
12 <PackageGroup Id="DesktopNetCoreRuntime31Redist_x64">
13 <PackageGroupRef Id="DesktopNetCoreRuntime3112Redist_x64" />
14 </PackageGroup>
15 </Fragment>
16
17 <Fragment>
18 <PackageGroup Id="DotNetCoreRuntime31Redist_x64">
19 <PackageGroupRef Id="DotNetCoreRuntime3112Redist_x64" />
20 </PackageGroup>
21 </Fragment>
22</Wix>
diff --git a/src/ext/NetFx/wixlib/NetCore3.1_x86.wxs b/src/ext/NetFx/wixlib/NetCore3.1_x86.wxs
deleted file mode 100644
index cfff07b3..00000000
--- a/src/ext/NetFx/wixlib/NetCore3.1_x86.wxs
+++ /dev/null
@@ -1,22 +0,0 @@
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">
4
5 <Fragment>
6 <PackageGroup Id="AspNetCoreRuntime31Redist_x86">
7 <PackageGroupRef Id="AspNetCoreRuntime3112Redist_x86" />
8 </PackageGroup>
9 </Fragment>
10
11 <Fragment>
12 <PackageGroup Id="DesktopNetCoreRuntime31Redist_x86">
13 <PackageGroupRef Id="DesktopNetCoreRuntime3112Redist_x86" />
14 </PackageGroup>
15 </Fragment>
16
17 <Fragment>
18 <PackageGroup Id="DotNetCoreRuntime31Redist_x86">
19 <PackageGroupRef Id="DotNetCoreRuntime3112Redist_x86" />
20 </PackageGroup>
21 </Fragment>
22</Wix>
diff --git a/src/ext/NetFx/wixlib/NetCoreShared.wxs b/src/ext/NetFx/wixlib/NetCoreShared.wxs
index 2045a5b9..51667117 100644
--- a/src/ext/NetFx/wixlib/NetCoreShared.wxs
+++ b/src/ext/NetFx/wixlib/NetCoreShared.wxs
@@ -1,8 +1,8 @@
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. --> 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 2
3<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util"> 3<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
4 4
5 <?foreach PLATFORM in x86;x64?> 5 <?foreach PLATFORM in x86;x64;arm64?>
6 <Fragment> 6 <Fragment>
7 <util:RegistrySearch Id="DOTNETHOME_$(var.PLATFORM)" Variable="DOTNETHOME_$(var.PLATFORM)" Root="HKLM" Key="SOFTWARE\dotnet\Setup\InstalledVersions\$(var.PLATFORM)" Value="InstallLocation" Result="value" Bitness="always32" /> 7 <util:RegistrySearch Id="DOTNETHOME_$(var.PLATFORM)" Variable="DOTNETHOME_$(var.PLATFORM)" Root="HKLM" Key="SOFTWARE\dotnet\Setup\InstalledVersions\$(var.PLATFORM)" Value="InstallLocation" Result="value" Bitness="always32" />
8 </Fragment> 8 </Fragment>
diff --git a/src/ext/NetFx/wixlib/NetfxBundleExtension_Platform.wxi b/src/ext/NetFx/wixlib/NetfxBundleExtension_Platform.wxi
new file mode 100644
index 00000000..e3300534
--- /dev/null
+++ b/src/ext/NetFx/wixlib/NetfxBundleExtension_Platform.wxi
@@ -0,0 +1,15 @@
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
4<Include xmlns="http://wixtoolset.org/schemas/v4/wxs">
5 <?include ..\..\caDecor.wxi ?>
6
7 <Fragment>
8 <BundleExtension Id="$(var.Prefix)NetfxBundleExtension$(var.Suffix)" SourceFile="!(bindpath.$(var.platform))netfxbe.dll" Name="$(var.Prefix)NetfxBundleExtension$(var.Suffix)\netfxbe.dll">
9 <?foreach PLATFORM in x86;x64;arm64?>
10 <Payload SourceFile="!(bindpath.$(var.PLATFORM))netcoresearch.exe" Name="$(var.Prefix)NetfxBundleExtension$(var.Suffix)\$(var.PLATFORM)\netcoresearch.exe" />
11 <Payload SourceFile="!(bindpath.$(var.PLATFORM))hostfxr.dll" Name="$(var.Prefix)NetfxBundleExtension$(var.Suffix)\$(var.PLATFORM)\hostfxr.dll" />
12 <?endforeach?>
13 </BundleExtension>
14 </Fragment>
15</Include>
diff --git a/src/ext/NetFx/wixlib/NetfxBundleExtension_arm64.wxs b/src/ext/NetFx/wixlib/NetfxBundleExtension_arm64.wxs
new file mode 100644
index 00000000..13757dd8
--- /dev/null
+++ b/src/ext/NetFx/wixlib/NetfxBundleExtension_arm64.wxs
@@ -0,0 +1,7 @@
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
4<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
5 <?define platform=arm64 ?>
6 <?include NetfxBundleExtension_Platform.wxi ?>
7</Wix>
diff --git a/src/ext/NetFx/wixlib/NetfxBundleExtension_x64.wxs b/src/ext/NetFx/wixlib/NetfxBundleExtension_x64.wxs
new file mode 100644
index 00000000..f6c27a8e
--- /dev/null
+++ b/src/ext/NetFx/wixlib/NetfxBundleExtension_x64.wxs
@@ -0,0 +1,7 @@
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
4<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
5 <?define platform=x64 ?>
6 <?include NetfxBundleExtension_Platform.wxi ?>
7</Wix>
diff --git a/src/ext/NetFx/wixlib/NetfxBundleExtension_x86.wxs b/src/ext/NetFx/wixlib/NetfxBundleExtension_x86.wxs
new file mode 100644
index 00000000..76a8358f
--- /dev/null
+++ b/src/ext/NetFx/wixlib/NetfxBundleExtension_x86.wxs
@@ -0,0 +1,7 @@
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
4<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
5 <?define platform=x86 ?>
6 <?include NetfxBundleExtension_Platform.wxi ?>
7</Wix>
diff --git a/src/ext/NetFx/wixlib/netfx.wixproj b/src/ext/NetFx/wixlib/netfx.wixproj
index ad7d028c..bc6a1172 100644
--- a/src/ext/NetFx/wixlib/netfx.wixproj
+++ b/src/ext/NetFx/wixlib/netfx.wixproj
@@ -14,9 +14,15 @@
14 </ItemGroup> 14 </ItemGroup>
15 15
16 <ItemGroup> 16 <ItemGroup>
17 <ProjectReference Include="..\ca\netfxca.vcxproj" Properties="Platform=ARM64" ReferenceOutputAssembly="false" /> 17 <ProjectReference Include="..\be\netfxbe.vcxproj" Properties="Platform=ARM64" />
18 <ProjectReference Include="..\ca\netfxca.vcxproj" Properties="Platform=x86" ReferenceOutputAssembly="false" /> 18 <ProjectReference Include="..\be\netfxbe.vcxproj" Properties="Platform=x64" />
19 <ProjectReference Include="..\ca\netfxca.vcxproj" Properties="Platform=x64" ReferenceOutputAssembly="false" /> 19 <ProjectReference Include="..\be\netfxbe.vcxproj" Properties="Platform=x86" />
20 <ProjectReference Include="..\ca\netfxca.vcxproj" Properties="Platform=ARM64" />
21 <ProjectReference Include="..\ca\netfxca.vcxproj" Properties="Platform=x86" />
22 <ProjectReference Include="..\ca\netfxca.vcxproj" Properties="Platform=x64" />
23 <ProjectReference Include="..\netcoresearch\netcoresearch.vcxproj" Properties="Platform=ARM64" />
24 <ProjectReference Include="..\netcoresearch\netcoresearch.vcxproj" Properties="Platform=x86" />
25 <ProjectReference Include="..\netcoresearch\netcoresearch.vcxproj" Properties="Platform=x64" />
20 </ItemGroup> 26 </ItemGroup>
21 27
22 <ItemGroup> 28 <ItemGroup>
diff --git a/src/ext/Util/be/UtilBundleExtension.cpp b/src/ext/Util/be/UtilBundleExtension.cpp
index 110599fa..23f5d94f 100644
--- a/src/ext/Util/be/UtilBundleExtension.cpp
+++ b/src/ext/Util/be/UtilBundleExtension.cpp
@@ -28,16 +28,16 @@ public: //CBextBaseBundleExtension
28 IXMLDOMNode* pixnBundleExtension = NULL; 28 IXMLDOMNode* pixnBundleExtension = NULL;
29 29
30 hr = __super::Initialize(pCreateArgs); 30 hr = __super::Initialize(pCreateArgs);
31 ExitOnFailure(hr, "CBextBaseBundleExtension initialization failed."); 31 BextExitOnFailure(hr, "CBextBaseBundleExtension initialization failed.");
32 32
33 hr = XmlLoadDocumentFromFile(m_sczBundleExtensionDataPath, &pixdManifest); 33 hr = XmlLoadDocumentFromFile(m_sczBundleExtensionDataPath, &pixdManifest);
34 ExitOnFailure(hr, "Failed to load bundle extension manifest from path: %ls", m_sczBundleExtensionDataPath); 34 BextExitOnFailure(hr, "Failed to load bundle extension manifest from path: %ls", m_sczBundleExtensionDataPath);
35 35
36 hr = BextGetBundleExtensionDataNode(pixdManifest, UTIL_BUNDLE_EXTENSION_ID, &pixnBundleExtension); 36 hr = BextGetBundleExtensionDataNode(pixdManifest, UTIL_BUNDLE_EXTENSION_ID, &pixnBundleExtension);
37 ExitOnFailure(hr, "Failed to get BundleExtension '%ls'", UTIL_BUNDLE_EXTENSION_ID); 37 BextExitOnFailure(hr, "Failed to get BundleExtension '%ls'", UTIL_BUNDLE_EXTENSION_ID);
38 38
39 hr = UtilSearchParseFromXml(&m_searches, pixnBundleExtension); 39 hr = UtilSearchParseFromXml(&m_searches, pixnBundleExtension);
40 ExitOnFailure(hr, "Failed to parse searches from bundle extension manifest."); 40 BextExitOnFailure(hr, "Failed to parse searches from bundle extension manifest.");
41 41
42 LExit: 42 LExit:
43 ReleaseObject(pixnBundleExtension); 43 ReleaseObject(pixnBundleExtension);
@@ -73,10 +73,10 @@ HRESULT UtilBundleExtensionCreate(
73 CWixUtilBundleExtension* pExtension = NULL; 73 CWixUtilBundleExtension* pExtension = NULL;
74 74
75 pExtension = new CWixUtilBundleExtension(pEngine); 75 pExtension = new CWixUtilBundleExtension(pEngine);
76 ExitOnNull(pExtension, hr, E_OUTOFMEMORY, "Failed to create new CWixUtilBundleExtension."); 76 BextExitOnNull(pExtension, hr, E_OUTOFMEMORY, "Failed to create new CWixUtilBundleExtension.");
77 77
78 hr = pExtension->Initialize(pArgs); 78 hr = pExtension->Initialize(pArgs);
79 ExitOnFailure(hr, "CWixUtilBundleExtension initialization failed."); 79 BextExitOnFailure(hr, "CWixUtilBundleExtension initialization failed.");
80 80
81 *ppBundleExtension = pExtension; 81 *ppBundleExtension = pExtension;
82 pExtension = NULL; 82 pExtension = NULL;
diff --git a/src/ext/Util/be/detectsha2support.cpp b/src/ext/Util/be/detectsha2support.cpp
index 90e349cd..4abfc63c 100644
--- a/src/ext/Util/be/detectsha2support.cpp
+++ b/src/ext/Util/be/detectsha2support.cpp
@@ -13,7 +13,7 @@ HRESULT DetectSHA2CodeSigning(
13 DWORD er = ERROR_SUCCESS; 13 DWORD er = ERROR_SUCCESS;
14 14
15 hr = LoadSystemLibrary(L"wintrust.dll", &hModule); 15 hr = LoadSystemLibrary(L"wintrust.dll", &hModule);
16 ExitOnFailure(hr, "Failed to load wintrust.dll"); 16 BextExitOnFailure(hr, "Failed to load wintrust.dll");
17 17
18 pfn = ::GetProcAddress(hModule, "CryptCATAdminAcquireContext2"); 18 pfn = ::GetProcAddress(hModule, "CryptCATAdminAcquireContext2");
19 if (pfn) 19 if (pfn)
@@ -30,7 +30,7 @@ HRESULT DetectSHA2CodeSigning(
30 } 30 }
31 31
32 hr = HRESULT_FROM_WIN32(er); 32 hr = HRESULT_FROM_WIN32(er);
33 ExitOnFailure(hr, "Failed to probe for CryptCATAdminAcquireContext2 in wintrust.dll"); 33 BextExitOnFailure(hr, "Failed to probe for CryptCATAdminAcquireContext2 in wintrust.dll");
34 34
35LExit: 35LExit:
36 ::FreeLibrary(hModule); 36 ::FreeLibrary(hModule);
@@ -48,10 +48,10 @@ HRESULT UtilPerformDetectSHA2CodeSigning(
48 BOOL fSupported = FALSE; 48 BOOL fSupported = FALSE;
49 49
50 hr = DetectSHA2CodeSigning(&fSupported); 50 hr = DetectSHA2CodeSigning(&fSupported);
51 ExitOnFailure(hr, "DetectSHA2CodeSigning failed."); 51 BextExitOnFailure(hr, "DetectSHA2CodeSigning failed.");
52 52
53 hr = pEngine->SetVariableNumeric(wzVariable, fSupported ? 1 : 0); 53 hr = pEngine->SetVariableNumeric(wzVariable, fSupported ? 1 : 0);
54 ExitOnFailure(hr, "Failed to set variable '%ls'", wzVariable); 54 BextExitOnFailure(hr, "Failed to set variable '%ls'", wzVariable);
55 55
56LExit: 56LExit:
57 return hr; 57 return hr;
diff --git a/src/ext/Util/be/precomp.h b/src/ext/Util/be/precomp.h
index bb36b3f3..5ce5744f 100644
--- a/src/ext/Util/be/precomp.h
+++ b/src/ext/Util/be/precomp.h
@@ -31,7 +31,7 @@
31#include <bextutil.h> 31#include <bextutil.h>
32#include <BextBundleExtensionEngine.h> 32#include <BextBundleExtensionEngine.h>
33 33
34#include "beDecor.h" 34#include "..\..\beDecor.h"
35#include "utilsearch.h" 35#include "utilsearch.h"
36#include "detectsha2support.h" 36#include "detectsha2support.h"
37#include "UtilBundleExtension.h" 37#include "UtilBundleExtension.h"
diff --git a/src/ext/Util/be/utilbe.vcxproj b/src/ext/Util/be/utilbe.vcxproj
index 4e4f80d9..fa39dcf3 100644
--- a/src/ext/Util/be/utilbe.vcxproj
+++ b/src/ext/Util/be/utilbe.vcxproj
@@ -56,7 +56,6 @@
56 </ItemGroup> 56 </ItemGroup>
57 57
58 <ItemGroup> 58 <ItemGroup>
59 <ClInclude Include="beDecor.h" />
60 <ClInclude Include="detectsha2support.h" /> 59 <ClInclude Include="detectsha2support.h" />
61 <ClInclude Include="precomp.h" /> 60 <ClInclude Include="precomp.h" />
62 <ClInclude Include="UtilBundleExtension.h" /> 61 <ClInclude Include="UtilBundleExtension.h" />
diff --git a/src/ext/Util/be/utilsearch.cpp b/src/ext/Util/be/utilsearch.cpp
index 7cd2ea09..20a514d8 100644
--- a/src/ext/Util/be/utilsearch.cpp
+++ b/src/ext/Util/be/utilsearch.cpp
@@ -17,11 +17,11 @@ STDMETHODIMP UtilSearchParseFromXml(
17 17
18 // Select Util search nodes. 18 // Select Util search nodes.
19 hr = XmlSelectNodes(pixnBundleExtension, L"WixWindowsFeatureSearch", &pixnNodes); 19 hr = XmlSelectNodes(pixnBundleExtension, L"WixWindowsFeatureSearch", &pixnNodes);
20 ExitOnFailure(hr, "Failed to select Util search nodes."); 20 BextExitOnFailure(hr, "Failed to select Util search nodes.");
21 21
22 // Get Util search node count. 22 // Get Util search node count.
23 hr = pixnNodes->get_length((long*)&cNodes); 23 hr = pixnNodes->get_length((long*)&cNodes);
24 ExitOnFailure(hr, "Failed to get Util search node count."); 24 BextExitOnFailure(hr, "Failed to get Util search node count.");
25 25
26 if (!cNodes) 26 if (!cNodes)
27 { 27 {
@@ -30,7 +30,7 @@ STDMETHODIMP UtilSearchParseFromXml(
30 30
31 // Allocate memory for searches. 31 // Allocate memory for searches.
32 pSearches->rgSearches = (UTIL_SEARCH*)MemAlloc(sizeof(UTIL_SEARCH) * cNodes, TRUE); 32 pSearches->rgSearches = (UTIL_SEARCH*)MemAlloc(sizeof(UTIL_SEARCH) * cNodes, TRUE);
33 ExitOnNull(pSearches->rgSearches, hr, E_OUTOFMEMORY, "Failed to allocate memory for search structs."); 33 BextExitOnNull(pSearches->rgSearches, hr, E_OUTOFMEMORY, "Failed to allocate memory for search structs.");
34 34
35 pSearches->cSearches = cNodes; 35 pSearches->cSearches = cNodes;
36 36
@@ -40,11 +40,11 @@ STDMETHODIMP UtilSearchParseFromXml(
40 UTIL_SEARCH* pSearch = &pSearches->rgSearches[i]; 40 UTIL_SEARCH* pSearch = &pSearches->rgSearches[i];
41 41
42 hr = XmlNextElement(pixnNodes, &pixnNode, &bstrNodeName); 42 hr = XmlNextElement(pixnNodes, &pixnNode, &bstrNodeName);
43 ExitOnFailure(hr, "Failed to get next node."); 43 BextExitOnFailure(hr, "Failed to get next node.");
44 44
45 // @Id 45 // @Id
46 hr = XmlGetAttributeEx(pixnNode, L"Id", &pSearch->sczId); 46 hr = XmlGetAttributeEx(pixnNode, L"Id", &pSearch->sczId);
47 ExitOnFailure(hr, "Failed to get @Id."); 47 BextExitOnFailure(hr, "Failed to get @Id.");
48 48
49 // Read type specific attributes. 49 // Read type specific attributes.
50 if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, bstrNodeName, -1, L"WixWindowsFeatureSearch", -1)) 50 if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, bstrNodeName, -1, L"WixWindowsFeatureSearch", -1))
@@ -53,7 +53,7 @@ STDMETHODIMP UtilSearchParseFromXml(
53 53
54 // @Type 54 // @Type
55 hr = XmlGetAttributeEx(pixnNode, L"Type", &scz); 55 hr = XmlGetAttributeEx(pixnNode, L"Type", &scz);
56 ExitOnFailure(hr, "Failed to get @Type."); 56 BextExitOnFailure(hr, "Failed to get @Type.");
57 57
58 if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, scz, -1, L"sha2CodeSigning", -1)) 58 if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, scz, -1, L"sha2CodeSigning", -1))
59 { 59 {
@@ -61,14 +61,12 @@ STDMETHODIMP UtilSearchParseFromXml(
61 } 61 }
62 else 62 else
63 { 63 {
64 hr = E_INVALIDARG; 64 BextExitWithRootFailure(hr, E_INVALIDARG, "Invalid value for @Type: %ls", scz);
65 ExitOnFailure(hr, "Invalid value for @Type: %ls", scz);
66 } 65 }
67 } 66 }
68 else 67 else
69 { 68 {
70 hr = E_UNEXPECTED; 69 BextExitWithRootFailure(hr, E_UNEXPECTED, "Unexpected element name: %ls", bstrNodeName);
71 ExitOnFailure(hr, "Unexpected element name: %ls", bstrNodeName);
72 } 70 }
73 71
74 // prepare next iteration 72 // prepare next iteration
@@ -112,7 +110,7 @@ STDMETHODIMP UtilSearchExecute(
112 UTIL_SEARCH* pSearch = NULL; 110 UTIL_SEARCH* pSearch = NULL;
113 111
114 hr = UtilSearchFindById(pSearches, wzSearchId, &pSearch); 112 hr = UtilSearchFindById(pSearches, wzSearchId, &pSearch);
115 ExitOnFailure(hr, "Search id '%ls' is unknown to the util extension."); 113 BextExitOnFailure(hr, "Search id '%ls' is unknown to the util extension.", wzSearchId);
116 114
117 switch (pSearch->Type) 115 switch (pSearch->Type)
118 { 116 {
diff --git a/src/ext/Util/wixext/Symbols/UtilSymbolDefinitions.cs b/src/ext/Util/wixext/Symbols/UtilSymbolDefinitions.cs
index 72091c3b..3b357a96 100644
--- a/src/ext/Util/wixext/Symbols/UtilSymbolDefinitions.cs
+++ b/src/ext/Util/wixext/Symbols/UtilSymbolDefinitions.cs
@@ -33,8 +33,6 @@ namespace WixToolset.Util
33 33
34 public static partial class UtilSymbolDefinitions 34 public static partial class UtilSymbolDefinitions
35 { 35 {
36 public static readonly Version Version = new Version("4.0.0");
37
38 public static IntermediateSymbolDefinition ByName(string name) 36 public static IntermediateSymbolDefinition ByName(string name)
39 { 37 {
40 if (!Enum.TryParse(name, out UtilSymbolDefinitionType type)) 38 if (!Enum.TryParse(name, out UtilSymbolDefinitionType type))
diff --git a/src/ext/Util/be/beDecor.h b/src/ext/beDecor.h
index 2c6a8818..2c6a8818 100644
--- a/src/ext/Util/be/beDecor.h
+++ b/src/ext/beDecor.h
diff --git a/src/libs/dutil/WixToolset.DUtil/inc/procutil.h b/src/libs/dutil/WixToolset.DUtil/inc/procutil.h
index 6a641a5b..e7e91705 100644
--- a/src/libs/dutil/WixToolset.DUtil/inc/procutil.h
+++ b/src/libs/dutil/WixToolset.DUtil/inc/procutil.h
@@ -62,6 +62,7 @@ HRESULT DAPI ProcExec(
62 __out HANDLE *phProcess 62 __out HANDLE *phProcess
63 ); 63 );
64HRESULT DAPI ProcExecute( 64HRESULT DAPI ProcExecute(
65 __in_z_opt LPCWSTR wzApplicationName,
65 __in_z LPWSTR wzCommand, 66 __in_z LPWSTR wzCommand,
66 __out HANDLE *phProcess, 67 __out HANDLE *phProcess,
67 __out_opt HANDLE *phChildStdIn, 68 __out_opt HANDLE *phChildStdIn,
@@ -73,7 +74,7 @@ HRESULT DAPI ProcWaitForCompletion(
73 __out_opt DWORD* pdwReturnCode 74 __out_opt DWORD* pdwReturnCode
74 ); 75 );
75HRESULT DAPI ProcWaitForIds( 76HRESULT DAPI ProcWaitForIds(
76 __in_ecount(cProcessIds) const DWORD* pdwProcessIds, 77 __in_ecount(cProcessIds) const DWORD rgdwProcessIds[],
77 __in DWORD cProcessIds, 78 __in DWORD cProcessIds,
78 __in DWORD dwMilliseconds 79 __in DWORD dwMilliseconds
79 ); 80 );
diff --git a/src/libs/dutil/WixToolset.DUtil/procutil.cpp b/src/libs/dutil/WixToolset.DUtil/procutil.cpp
index 376aec6d..f96a1999 100644
--- a/src/libs/dutil/WixToolset.DUtil/procutil.cpp
+++ b/src/libs/dutil/WixToolset.DUtil/procutil.cpp
@@ -375,6 +375,7 @@ LExit:
375 375
376*******************************************************************/ 376*******************************************************************/
377extern "C" HRESULT DAPI ProcExecute( 377extern "C" HRESULT DAPI ProcExecute(
378 __in_z_opt LPCWSTR wzApplicationName,
378 __in_z LPWSTR wzCommand, 379 __in_z LPWSTR wzCommand,
379 __out HANDLE *phProcess, 380 __out HANDLE *phProcess,
380 __out_opt HANDLE *phChildStdIn, 381 __out_opt HANDLE *phChildStdIn,
@@ -405,7 +406,7 @@ extern "C" HRESULT DAPI ProcExecute(
405 406
406#pragma prefast(push) 407#pragma prefast(push)
407#pragma prefast(disable:25028) 408#pragma prefast(disable:25028)
408 if (::CreateProcessW(NULL, 409 if (::CreateProcessW(wzApplicationName,
409 wzCommand, // command line 410 wzCommand, // command line
410 NULL, // security info 411 NULL, // security info
411 NULL, // thread info 412 NULL, // thread info
diff --git a/src/test/burn/TestData/TestBA/TestBAWixlib/NetCore6.0.9_x86.wxs b/src/test/burn/TestData/TestBA/TestBAWixlib/NetCore6.0.9_x86.wxs
new file mode 100644
index 00000000..6bfef872
--- /dev/null
+++ b/src/test/burn/TestData/TestBA/TestBAWixlib/NetCore6.0.9_x86.wxs
@@ -0,0 +1,58 @@
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:netfx="http://wixtoolset.org/schemas/v4/wxs/netfx">
4
5 <?define NetCorePlatform = x86?>
6 <?define NetCoreIdVersion = 609?>
7 <?define NetCoreVersion = 6.0.9?>
8 <?include NetCore6_Platform.wxi?>
9
10 <?define AspNetCoreRedistLink = https://download.visualstudio.microsoft.com/download/pr/8f583028-b802-4661-b8dd-47139b0561ce/3c0cd3bdc6051759ccae40f78982c86e/aspnetcore-runtime-6.0.9-win-x86.exe?>
11 <?define DesktopNetCoreRedistLink = https://download.visualstudio.microsoft.com/download/pr/925f9407-2767-4341-857a-43cdfad71e17/0b84db913bdbb1dcf02db937a3cd3f63/windowsdesktop-runtime-6.0.9-win-x86.exe?>
12 <?define DotNetCoreRedistLink = https://download.visualstudio.microsoft.com/download/pr/6020f3fc-5cf8-4e25-bc7f-dcf8744137ac/4cb5ced4e015e426fddc554b130c3052/dotnet-runtime-6.0.9-win-x86.exe?>
13
14 <Fragment>
15 <netfx:DotNetCoreSearch Id="$(var.AspNetCoreId)" RuntimeType="aspnet" Platform="$(var.NetCorePlatform)" MajorVersion="6" Variable="$(var.AspNetCoreId)" />
16
17 <WixVariable Id="AspNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)DetectCondition" Value="$(var.AspNetCoreId)" Overridable="yes" />
18 <WixVariable Id="AspNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)InstallCondition" Value="" Overridable="yes" />
19 <WixVariable Id="AspNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)PackageDirectory" Value="redist\" Overridable="yes" />
20 <WixVariable Id="AspNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)RepairArguments" Value="" Overridable="yes" />
21
22 <PackageGroup Id="$(var.AspNetCoreRedistId)">
23 <ExePackage InstallArguments="$(var.AspNetCoreRedistInstallArguments)" PerMachine="yes" DetectCondition="!(wix.AspNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)DetectCondition)" InstallCondition="!(wix.AspNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)InstallCondition)" Id="$(var.AspNetCoreRedistId)" Vital="yes" Permanent="yes" Protocol="burn" LogPathVariable="$(var.AspNetCoreRedistLog)" Cache="remove">
24 <ExePackagePayload Name="!(wix.AspNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)PackageDirectory)aspnetcore-runtime-$(var.NetCoreVersion)-win-$(var.NetCorePlatform).exe" DownloadUrl="$(var.AspNetCoreRedistLink)" ProductName="Microsoft ASP.NET Core 6.0.9 - Shared Framework (x86)" Description="Microsoft ASP.NET Core 6.0.9 - Shared Framework (x86)" Hash="493D9A5388A0E6BEF4FED091465B58A5CC6D9C148478E5A9822D76ECA61395CFFA93EBADAEC78C9F7E1DA5CCECC00881BAF10B757CA9C4EB9D475FB8EDE7FC53" Size="8255248" Version="6.0.9.22419" />
25 </ExePackage>
26 </PackageGroup>
27 </Fragment>
28
29 <Fragment>
30 <netfx:DotNetCoreSearch Id="$(var.DesktopNetCoreId)" RuntimeType="desktop" Platform="$(var.NetCorePlatform)" MajorVersion="6" Variable="$(var.DesktopNetCoreId)" />
31
32 <WixVariable Id="DesktopNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)DetectCondition" Value="$(var.DesktopNetCoreId)" Overridable="yes" />
33 <WixVariable Id="DesktopNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)InstallCondition" Value="" Overridable="yes" />
34 <WixVariable Id="DesktopNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)PackageDirectory" Value="redist\" Overridable="yes" />
35 <WixVariable Id="DesktopNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)RepairArguments" Value="" Overridable="yes" />
36
37 <PackageGroup Id="$(var.DesktopNetCoreRedistId)">
38 <ExePackage InstallArguments="$(var.DesktopNetCoreRedistInstallArguments)" PerMachine="yes" DetectCondition="!(wix.DesktopNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)DetectCondition)" InstallCondition="!(wix.DesktopNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)InstallCondition)" Id="$(var.DesktopNetCoreRedistId)" Vital="yes" Permanent="yes" Protocol="burn" LogPathVariable="$(var.DesktopNetCoreRedistLog)" Cache="remove">
39 <ExePackagePayload Name="!(wix.DesktopNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)PackageDirectory)windowsdesktop-runtime-$(var.NetCoreVersion)-win-$(var.NetCorePlatform).exe" DownloadUrl="$(var.DesktopNetCoreRedistLink)" ProductName="Microsoft Windows Desktop Runtime - 6.0.9 (x86)" Description="Microsoft Windows Desktop Runtime - 6.0.9 (x86)" Hash="6B45A936A15710E22A03C64AD4F37EE4A934D957D31E78F73533099109BBEECDB8EAB7EC0749C2ECBCF90B72C9D6C7462252885F7C502F68E636167CACBA3DE0" Size="52443656" Version="6.0.9.31620" />
40 </ExePackage>
41 </PackageGroup>
42 </Fragment>
43
44 <Fragment>
45 <netfx:DotNetCoreSearch Id="$(var.DotNetCoreId)" RuntimeType="core" Platform="$(var.NetCorePlatform)" MajorVersion="6" Variable="$(var.DotNetCoreId)" />
46
47 <WixVariable Id="DotNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)DetectCondition" Value="$(var.DotNetCoreId)" Overridable="yes" />
48 <WixVariable Id="DotNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)InstallCondition" Value="" Overridable="yes" />
49 <WixVariable Id="DotNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)PackageDirectory" Value="redist\" Overridable="yes" />
50 <WixVariable Id="DotNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)RepairArguments" Value="" Overridable="yes" />
51
52 <PackageGroup Id="$(var.DotNetCoreRedistId)">
53 <ExePackage InstallArguments="$(var.DotNetCoreRedistInstallArguments)" PerMachine="yes" DetectCondition="!(wix.DotNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)DetectCondition)" InstallCondition="!(wix.DotNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)InstallCondition)" Id="$(var.DotNetCoreRedistId)" Vital="yes" Permanent="yes" Protocol="burn" LogPathVariable="$(var.DotNetCoreRedistLog)" Cache="remove">
54 <ExePackagePayload Name="!(wix.DotNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)PackageDirectory)dotnet-runtime-$(var.NetCoreVersion)-win-$(var.NetCorePlatform).exe" DownloadUrl="$(var.DotNetCoreRedistLink)" ProductName="Microsoft .NET Runtime - 6.0.9 (x86)" Description="Microsoft .NET Runtime - 6.0.9 (x86)" Hash="4A5EE2E0297140FB4B6064540CBB9D520C1B3BEF474F8342DFC5AAED0FD85B7FE26C49F85D17686E85540D421DA57EB2AE4D2B402C5184A6EF2EADED33B097A9" Size="25803488" Version="6.0.9.31619" />
55 </ExePackage>
56 </PackageGroup>
57 </Fragment>
58</Wix>
diff --git a/src/test/burn/TestData/TestBA/TestBAWixlib/NetCore6_Platform.wxi b/src/test/burn/TestData/TestBA/TestBAWixlib/NetCore6_Platform.wxi
new file mode 100644
index 00000000..d508bcaf
--- /dev/null
+++ b/src/test/burn/TestData/TestBA/TestBAWixlib/NetCore6_Platform.wxi
@@ -0,0 +1,49 @@
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
4<Include 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">
5
6 <?define AspNetCoreId = ASPNETCORERUNTIME6_$(var.NetCorePlatform)?>
7 <?define AspNetCoreRedistId = AspNetCoreRuntime$(var.NetCoreIdVersion)Redist_$(var.NetCorePlatform)?>
8 <?define AspNetCoreRedistLog = AspNetCoreRuntime$(var.NetCoreIdVersion)RedistLog?>
9 <?define AspNetCoreRedistInstallArguments = /install /quiet /log "[$(var.AspNetCoreRedistLog)]"?>
10 <?define AspNetCoreRedistUninstallArguments = /uninstall /quiet /log "[$(var.AspNetCoreRedistLog)]"?>
11
12 <?define DesktopNetCoreId = DESKTOPNETCORERUNTIME6_$(var.NetCorePlatform)?>
13 <?define DesktopNetCoreRedistId = DesktopNetCoreRuntime$(var.NetCoreIdVersion)Redist_$(var.NetCorePlatform)?>
14 <?define DesktopNetCoreRedistLog = DesktopNetCoreRuntime$(var.NetCoreIdVersion)RedistLog?>
15 <?define DesktopNetCoreRedistInstallArguments = /install /quiet /log "[$(var.DesktopNetCoreRedistLog)]"?>
16 <?define DesktopNetCoreRedistUninstallArguments = /uninstall /quiet /log "[$(var.DesktopNetCoreRedistLog)]"?>
17
18 <?define DotNetCoreId = DOTNETCORERUNTIME6_$(var.NetCorePlatform)?>
19 <?define DotNetCoreRedistId = DotNetCoreRuntime$(var.NetCoreIdVersion)Redist_$(var.NetCorePlatform)?>
20 <?define DotNetCoreRedistLog = DotNetCoreRuntime$(var.NetCoreIdVersion)RedistLog?>
21 <?define DotNetCoreRedistInstallArguments = /install /quiet /log "[$(var.DotNetCoreRedistLog)]"?>
22 <?define DotNetCoreRedistUninstallArguments = /uninstall /quiet /log "[$(var.DotNetCoreRedistLog)]"?>
23
24 <?define NetCoreEulaLink = https://go.microsoft.com/fwlink/?LinkId=329770?>
25
26 <Fragment>
27 <PackageGroup Id="$(var.AspNetCoreRedistId)AsPrereq">
28 <PackageGroupRef Id="$(var.AspNetCoreRedistId)" />
29 </PackageGroup>
30
31 <bal:ManagedBootstrapperApplicationPrereqInformation PackageId="$(var.AspNetCoreRedistId)" LicenseUrl="$(var.NetCoreEulaLink)" />
32 </Fragment>
33
34 <Fragment>
35 <PackageGroup Id="$(var.DesktopNetCoreRedistId)AsPrereq">
36 <PackageGroupRef Id="$(var.DesktopNetCoreRedistId)" />
37 </PackageGroup>
38
39 <bal:ManagedBootstrapperApplicationPrereqInformation PackageId="$(var.DesktopNetCoreRedistId)" LicenseUrl="$(var.NetCoreEulaLink)" />
40 </Fragment>
41
42 <Fragment>
43 <PackageGroup Id="$(var.DotNetCoreRedistId)AsPrereq">
44 <PackageGroupRef Id="$(var.DotNetCoreRedistId)" />
45 </PackageGroup>
46
47 <bal:ManagedBootstrapperApplicationPrereqInformation PackageId="$(var.DotNetCoreRedistId)" LicenseUrl="$(var.NetCoreEulaLink)" />
48 </Fragment>
49</Include>
diff --git a/src/test/burn/TestData/TestBA/TestBAWixlib/TestBA.wxs b/src/test/burn/TestData/TestBA/TestBAWixlib/TestBA.wxs
index ae162050..2db22e4b 100644
--- a/src/test/burn/TestData/TestBA/TestBAWixlib/TestBA.wxs
+++ b/src/test/burn/TestData/TestBA/TestBAWixlib/TestBA.wxs
@@ -11,7 +11,7 @@
11 </BootstrapperApplication> 11 </BootstrapperApplication>
12 12
13 <PackageGroup Id="TestBAdnc"> 13 <PackageGroup Id="TestBAdnc">
14 <PackageGroupRef Id="NetFx48WebAsPrereq" /> <!-- Yes, this is wrong but we don't have .NET 6 packages yet --> 14 <PackageGroupRef Id="DesktopNetCoreRuntime609Redist_x86AsPrereq" />
15 </PackageGroup> 15 </PackageGroup>
16 </Fragment> 16 </Fragment>
17 <Fragment> 17 <Fragment>
diff --git a/src/test/burn/TestData/TestBA/TestBAWixlib/testbawixlib.wixproj b/src/test/burn/TestData/TestBA/TestBAWixlib/testbawixlib.wixproj
index 1dbc4f63..6ef417d0 100644
--- a/src/test/burn/TestData/TestBA/TestBAWixlib/testbawixlib.wixproj
+++ b/src/test/burn/TestData/TestBA/TestBAWixlib/testbawixlib.wixproj
@@ -17,5 +17,6 @@
17 </ItemGroup> 17 </ItemGroup>
18 <ItemGroup> 18 <ItemGroup>
19 <PackageReference Include="WixToolset.Bal.wixext" /> 19 <PackageReference Include="WixToolset.Bal.wixext" />
20 <PackageReference Include="WixToolset.Netfx.wixext" />
20 </ItemGroup> 21 </ItemGroup>
21</Project> \ No newline at end of file 22</Project> \ No newline at end of file
diff --git a/src/test/burn/TestData/TestBA/TestBAWixlib_x64/NetCore6.0.9_x64.wxs b/src/test/burn/TestData/TestBA/TestBAWixlib_x64/NetCore6.0.9_x64.wxs
new file mode 100644
index 00000000..f2345693
--- /dev/null
+++ b/src/test/burn/TestData/TestBA/TestBAWixlib_x64/NetCore6.0.9_x64.wxs
@@ -0,0 +1,58 @@
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:netfx="http://wixtoolset.org/schemas/v4/wxs/netfx">
4
5 <?define NetCorePlatform = x64?>
6 <?define NetCoreIdVersion = 609?>
7 <?define NetCoreVersion = 6.0.9?>
8 <?include ..\TestBAWixlib\NetCore6_Platform.wxi?>
9
10 <?define AspNetCoreRedistLink = https://download.visualstudio.microsoft.com/download/pr/98dbe241-8b77-4be0-b130-a5fb6af8d724/27b655adce6250da42be9440abe847a2/aspnetcore-runtime-6.0.9-win-x64.exe?>
11 <?define DesktopNetCoreRedistLink = https://download.visualstudio.microsoft.com/download/pr/fe8415d4-8a35-4af9-80a5-51306a96282d/05f9b2a1b4884238e69468e49b3a5453/windowsdesktop-runtime-6.0.9-win-x64.exe?>
12 <?define DotNetCoreRedistLink = https://download.visualstudio.microsoft.com/download/pr/9dc77a6b-0276-4ad5-9bfa-d84b546686ef/f01bbcf2dc0e7f5dbd0a7d337fd4cd43/dotnet-runtime-6.0.9-win-x64.exe?>
13
14 <Fragment>
15 <netfx:DotNetCoreSearch Id="$(var.AspNetCoreId)" RuntimeType="aspnet" Platform="$(var.NetCorePlatform)" MajorVersion="6" Variable="$(var.AspNetCoreId)" />
16
17 <WixVariable Id="AspNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)DetectCondition" Value="$(var.AspNetCoreId)" Overridable="yes" />
18 <WixVariable Id="AspNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)InstallCondition" Value="" Overridable="yes" />
19 <WixVariable Id="AspNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)PackageDirectory" Value="redist\" Overridable="yes" />
20 <WixVariable Id="AspNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)RepairArguments" Value="" Overridable="yes" />
21
22 <PackageGroup Id="$(var.AspNetCoreRedistId)">
23 <ExePackage InstallArguments="$(var.AspNetCoreRedistInstallArguments)" PerMachine="yes" DetectCondition="!(wix.AspNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)DetectCondition)" InstallCondition="!(wix.AspNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)InstallCondition)" Id="$(var.AspNetCoreRedistId)" Vital="yes" Permanent="yes" Protocol="burn" LogPathVariable="$(var.AspNetCoreRedistLog)" Cache="remove">
24 <ExePackagePayload Name="!(wix.AspNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)PackageDirectory)aspnetcore-runtime-$(var.NetCoreVersion)-win-$(var.NetCorePlatform).exe" DownloadUrl="$(var.AspNetCoreRedistLink)" ProductName="Microsoft ASP.NET Core 6.0.9 - Shared Framework (x64)" Description="Microsoft ASP.NET Core 6.0.9 - Shared Framework (x64)" Hash="E3FAE121878E5D98F49AEAA0A20B03ECE760FCF75429256B7AF13B78608EEAA2D2485578ED952A410CC590008023E62584233BAD0E34E9FA632D445BCE7FA1F5" Size="9010072" Version="6.0.9.22419" />
25 </ExePackage>
26 </PackageGroup>
27 </Fragment>
28
29 <Fragment>
30 <netfx:DotNetCoreSearch Id="$(var.DesktopNetCoreId)" RuntimeType="desktop" Platform="$(var.NetCorePlatform)" MajorVersion="6" Variable="$(var.DesktopNetCoreId)" />
31
32 <WixVariable Id="DesktopNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)DetectCondition" Value="$(var.DesktopNetCoreId)" Overridable="yes" />
33 <WixVariable Id="DesktopNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)InstallCondition" Value="" Overridable="yes" />
34 <WixVariable Id="DesktopNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)PackageDirectory" Value="redist\" Overridable="yes" />
35 <WixVariable Id="DesktopNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)RepairArguments" Value="" Overridable="yes" />
36
37 <PackageGroup Id="$(var.DesktopNetCoreRedistId)">
38 <ExePackage InstallArguments="$(var.DesktopNetCoreRedistInstallArguments)" PerMachine="yes" DetectCondition="!(wix.DesktopNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)DetectCondition)" InstallCondition="!(wix.DesktopNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)InstallCondition)" Id="$(var.DesktopNetCoreRedistId)" Vital="yes" Permanent="yes" Protocol="burn" LogPathVariable="$(var.DesktopNetCoreRedistLog)" Cache="remove">
39 <ExePackagePayload Name="!(wix.DesktopNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)PackageDirectory)windowsdesktop-runtime-$(var.NetCoreVersion)-win-$(var.NetCorePlatform).exe" DownloadUrl="$(var.DesktopNetCoreRedistLink)" ProductName="Microsoft Windows Desktop Runtime - 6.0.9 (x64)" Description="Microsoft Windows Desktop Runtime - 6.0.9 (x64)" Hash="28CC3D88E6FA54938177937118260E9129967246E30D2140FDB7A4A8E9E393EFEC689D6282EDB6982853FD3BA27701239A8D1EE81A2DD28C93B186F1A3CB1B55" Size="57328120" Version="6.0.9.31620" />
40 </ExePackage>
41 </PackageGroup>
42 </Fragment>
43
44 <Fragment>
45 <netfx:DotNetCoreSearch Id="$(var.DotNetCoreId)" RuntimeType="core" Platform="$(var.NetCorePlatform)" MajorVersion="6" Variable="$(var.DotNetCoreId)" />
46
47 <WixVariable Id="DotNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)DetectCondition" Value="$(var.DotNetCoreId)" Overridable="yes" />
48 <WixVariable Id="DotNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)InstallCondition" Value="" Overridable="yes" />
49 <WixVariable Id="DotNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)PackageDirectory" Value="redist\" Overridable="yes" />
50 <WixVariable Id="DotNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)RepairArguments" Value="" Overridable="yes" />
51
52 <PackageGroup Id="$(var.DotNetCoreRedistId)">
53 <ExePackage InstallArguments="$(var.DotNetCoreRedistInstallArguments)" PerMachine="yes" DetectCondition="!(wix.DotNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)DetectCondition)" InstallCondition="!(wix.DotNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)InstallCondition)" Id="$(var.DotNetCoreRedistId)" Vital="yes" Permanent="yes" Protocol="burn" LogPathVariable="$(var.DotNetCoreRedistLog)" Cache="remove">
54 <ExePackagePayload Name="!(wix.DotNetCoreRuntime$(var.NetCoreIdVersion)Redist$(var.NetCorePlatform)PackageDirectory)dotnet-runtime-$(var.NetCoreVersion)-win-$(var.NetCorePlatform).exe" DownloadUrl="$(var.DotNetCoreRedistLink)" ProductName="Microsoft .NET Runtime - 6.0.9 (x64)" Description="Microsoft .NET Runtime - 6.0.9 (x64)" Hash="5F4A73342B3563937F2EFB576AA101C29C0AD4908413BA87C415A733239B9AF196FF04778F2E8BF5845508B069812C13CA281EA5E912552AAB5227E7841E502D" Size="27912624" Version="6.0.9.31619" />
55 </ExePackage>
56 </PackageGroup>
57 </Fragment>
58</Wix>
diff --git a/src/test/burn/TestData/TestBA/TestBAWixlib_x64/TestBA_x64.wxs b/src/test/burn/TestData/TestBA/TestBAWixlib_x64/TestBA_x64.wxs
index df058958..f6a6382b 100644
--- a/src/test/burn/TestData/TestBA/TestBAWixlib_x64/TestBA_x64.wxs
+++ b/src/test/burn/TestData/TestBA/TestBAWixlib_x64/TestBA_x64.wxs
@@ -11,7 +11,7 @@
11 </BootstrapperApplication> 11 </BootstrapperApplication>
12 12
13 <PackageGroup Id="TestBAdnc_x64"> 13 <PackageGroup Id="TestBAdnc_x64">
14 <PackageGroupRef Id="NetFx48WebAsPrereq" /> <!-- Yes, this is wrong but we don't have .NET 6 packages yet --> 14 <PackageGroupRef Id="DesktopNetCoreRuntime609Redist_x64AsPrereq" />
15 </PackageGroup> 15 </PackageGroup>
16 </Fragment> 16 </Fragment>
17 <Fragment> 17 <Fragment>
diff --git a/src/test/burn/TestData/TestBA/TestBAWixlib_x64/WixBA_x64.wxs b/src/test/burn/TestData/TestBA/TestBAWixlib_x64/WixBA_x64.wxs
index bc5d4080..6cfbc937 100644
--- a/src/test/burn/TestData/TestBA/TestBAWixlib_x64/WixBA_x64.wxs
+++ b/src/test/burn/TestData/TestBA/TestBAWixlib_x64/WixBA_x64.wxs
@@ -12,7 +12,7 @@
12 </BootstrapperApplication> 12 </BootstrapperApplication>
13 13
14 <PackageGroup Id="WixBAdnc_x64"> 14 <PackageGroup Id="WixBAdnc_x64">
15 <PackageGroupRef Id="NetFx48WebAsPrereq" /> <!-- Yes, this is wrong but we don't have .NET 6 packages yet --> 15 <PackageGroupRef Id="DesktopNetCoreRuntime609Redist_x64AsPrereq" />
16 </PackageGroup> 16 </PackageGroup>
17 </Fragment> 17 </Fragment>
18</Wix> 18</Wix>
diff --git a/src/test/burn/TestData/TestBA/TestBAWixlib_x64/testbawixlib_x64.wixproj b/src/test/burn/TestData/TestBA/TestBAWixlib_x64/testbawixlib_x64.wixproj
index 3d714c4e..13f66a86 100644
--- a/src/test/burn/TestData/TestBA/TestBAWixlib_x64/testbawixlib_x64.wixproj
+++ b/src/test/burn/TestData/TestBA/TestBAWixlib_x64/testbawixlib_x64.wixproj
@@ -29,5 +29,6 @@
29 </ItemGroup> 29 </ItemGroup>
30 <ItemGroup> 30 <ItemGroup>
31 <PackageReference Include="WixToolset.Bal.wixext" /> 31 <PackageReference Include="WixToolset.Bal.wixext" />
32 <PackageReference Include="WixToolset.Netfx.wixext" />
32 </ItemGroup> 33 </ItemGroup>
33</Project> \ No newline at end of file 34</Project> \ No newline at end of file