aboutsummaryrefslogtreecommitdiff
path: root/src/ext/NetFx/be/detectnetcoresdkfeatureband.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ext/NetFx/be/detectnetcoresdkfeatureband.cpp')
-rw-r--r--src/ext/NetFx/be/detectnetcoresdkfeatureband.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/ext/NetFx/be/detectnetcoresdkfeatureband.cpp b/src/ext/NetFx/be/detectnetcoresdkfeatureband.cpp
new file mode 100644
index 00000000..d48c7a85
--- /dev/null
+++ b/src/ext/NetFx/be/detectnetcoresdkfeatureband.cpp
@@ -0,0 +1,55 @@
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 DetectNetCoreSdkFeatureBand(
6 __in NETFX_NET_CORE_PLATFORM platform,
7 __in LPCWSTR wzMajorVersion,
8 __in LPCWSTR wzMinorVersion,
9 __in LPCWSTR wzPatchVersion,
10 __in LPCWSTR wzBaseDirectory,
11 __inout LPWSTR* psczLatestVersion
12 )
13{
14 HRESULT hr = S_OK;
15 LPWSTR sczArguments = NULL;
16
17 hr = StrAllocFormatted(&sczArguments, L"sdkfeatureband %ls %ls %ls", wzMajorVersion, wzMinorVersion, wzPatchVersion);
18 BextExitOnFailure(hr, "Failed to build sdkfeatureband netcoresearch.exe arguments.");
19
20 hr = RunNetCoreSearch(platform, wzBaseDirectory, sczArguments, psczLatestVersion);
21 BextExitOnFailure(hr, "Failed to run netcoresearch.exe for sdkfeatureband.");
22
23LExit:
24 ReleaseStr(sczArguments);
25
26 return hr;
27}
28
29HRESULT NetfxPerformDetectNetCoreSdkFeatureBand(
30 __in LPCWSTR wzVariable,
31 __in NETFX_SEARCH* pSearch,
32 __in IBundleExtensionEngine* pEngine,
33 __in LPCWSTR wzBaseDirectory
34 )
35{
36 HRESULT hr = S_OK;
37 LPWSTR sczLatestVersion = NULL;
38
39 hr = DetectNetCoreSdkFeatureBand(
40 pSearch->NetCoreSdkFeatureBandSearch.platform,
41 pSearch->NetCoreSdkFeatureBandSearch.sczMajorVersion,
42 pSearch->NetCoreSdkFeatureBandSearch.sczMinorVersion,
43 pSearch->NetCoreSdkFeatureBandSearch.sczPatchVersion,
44 wzBaseDirectory,
45 &sczLatestVersion);
46 BextExitOnFailure(hr, "DetectNetCoreSdkFeatureBand failed.");
47
48 hr = pEngine->SetVariableVersion(wzVariable, sczLatestVersion);
49 BextExitOnFailure(hr, "Failed to set variable '%ls' to '%ls'", wzVariable, sczLatestVersion);
50
51LExit:
52 ReleaseStr(sczLatestVersion);
53
54 return hr;
55}