From 2761be4b10be7122f2a8b8d685a484ffc1cce329 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Wed, 15 Sep 2021 06:21:09 -0500 Subject: [PATCH] fix: set VCTargetsPath --- src/msvc/msvc.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/msvc/msvc.ts b/src/msvc/msvc.ts index 5911ce27..bf58fb4d 100644 --- a/src/msvc/msvc.ts +++ b/src/msvc/msvc.ts @@ -30,11 +30,12 @@ export async function setupMSVC( arch = osArch() ): Promise { let toolset: string | undefined + let VCTargetsPath: string | undefined if (version === "2015") { toolset = "14.0.25420.1" await setupChocoPack("visualcpp-build-tools", toolset, ["--ignore-dependencies", "--params", "'/IncludeRequired'"]) - const VCTargetsPath = "C:\\Program Files (x86)\\MSBuild\\Microsoft.Cpp\\v4.0\\v140" + VCTargetsPath = "C:\\Program Files (x86)\\MSBuild\\Microsoft.Cpp\\v4.0\\v140" if (existsSync(VCTargetsPath)) { exportVariable("VCTargetsPath", VCTargetsPath) } @@ -44,12 +45,17 @@ export async function setupMSVC( "--package-parameters", "add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended --passive", ]) + VCTargetsPath = "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\MSBuild\\Microsoft\\VC\\v150" } else if (version === "2019") { toolset = "16.11.2.0" await setupChocoPack("visualstudio2019buildtools", toolset, [ "--package-parameters", "add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended --passive", ]) + VCTargetsPath = "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\MSBuild\\Microsoft\\VC\\v160" + } + if (VCTargetsPath !== undefined && existsSync(VCTargetsPath)) { + exportVariable("VCTargetsPath", VCTargetsPath) } setupMSVCDevCmd(getArch(arch), sdk, toolset, uwp, spectre) }