@@ -236,61 +236,61 @@ if %target_arch%==x64 if %msvs_host_arch%==amd64 set vcvarsall_arg=amd64
236236@ rem also if both are x86
237237if %target_arch% == x86 if %msvs_host_arch% == x86 set vcvarsall_arg = x86
238238
239- @ rem Look for Visual Studio 2017
240- :vs-set-2017
241- if defined target_env if " %target_env% " NEQ " vs2017 " goto vs-set-2019
242- echo Looking for Visual Studio 2017
243- call tools\msvs\vswhere_usability_wrapper.cmd " [15 .0,16 .0)"
244- if " _%VCINSTALLDIR% _" == " __" goto msbuild-not-found
239+ @ rem Look for Visual Studio 2019
240+ :vs-set-2019
241+ if defined target_env if " %target_env% " NEQ " vs2019 " goto vs-set-2017
242+ echo Looking for Visual Studio 2019
243+ call tools\msvs\vswhere_usability_wrapper.cmd " [16 .0,17 .0)"
244+ if " _%VCINSTALLDIR% _" == " __" goto vs-set-2017
245245if defined msi (
246- echo Looking for WiX installation for Visual Studio 2017 ...
246+ echo Looking for WiX installation for Visual Studio 2019 ...
247247 if not exist " %WIX% \SDK\VS2017" (
248- echo Failed to find WiX install for Visual Studio 2017
249- echo VS2017 support for WiX is only present starting at version 3.11
250- goto msbuild-not-found
248+ echo Failed to find WiX install for Visual Studio 2019
249+ echo VS2019 support for WiX is only present starting at version 3.11
250+ goto vs-set-2017
251251 )
252252 if not exist " %VCINSTALLDIR% \..\MSBuild\Microsoft\WiX" (
253- echo Failed to find the WiX Toolset Visual Studio 2017 Extension
254- goto msbuild-not-found
253+ echo Failed to find the WiX Toolset Visual Studio 2019 Extension
254+ goto vs-set-2017
255255 )
256256)
257- @ rem check if VS2017 is already setup, and for the requested arch
258- if " _%VisualStudioVersion% _" == " _15 .0_" if " _%VSCMD_ARG_TGT_ARCH% _" == " _%target_arch% _" goto found_vs2017
257+ @ rem check if VS2019 is already setup, and for the requested arch
258+ if " _%VisualStudioVersion% _" == " _16 .0_" if " _%VSCMD_ARG_TGT_ARCH% _" == " _%target_arch% _" goto found_vs2019
259259@ rem need to clear VSINSTALLDIR for vcvarsall to work as expected
260260set " VSINSTALLDIR = "
261261@ rem prevent VsDevCmd.bat from changing the current working directory
262262set " VSCMD_START_DIR = %CD% "
263263set vcvars_call = " %VCINSTALLDIR% \Auxiliary\Build\vcvarsall.bat" %vcvarsall_arg%
264264echo calling: %vcvars_call%
265265call %vcvars_call%
266- if errorlevel 1 goto msbuild-not-found
266+ if errorlevel 1 goto vs-set-2017
267267if defined DEBUG_HELPER @ ECHO ON
268- :found_vs2017
268+ :found_vs2019
269269echo Found MSVS version %VisualStudioVersion%
270- set GYP_MSVS_VERSION = 2017
271- set PLATFORM_TOOLSET = v141
270+ set GYP_MSVS_VERSION = 2019
271+ set PLATFORM_TOOLSET = v142
272272goto msbuild-found
273273
274- @ rem Look for Visual Studio 2019
275- :vs-set-2019
276- if defined target_env if " %target_env% " NEQ " vs2019 " goto msbuild-not-found
277- echo Looking for Visual Studio 2019
278- call tools\msvs\vswhere_usability_wrapper.cmd " [16 .0,17 .0)"
274+ @ rem Look for Visual Studio 2017
275+ :vs-set-2017
276+ if defined target_env if " %target_env% " NEQ " vs2017 " goto msbuild-not-found
277+ echo Looking for Visual Studio 2017
278+ call tools\msvs\vswhere_usability_wrapper.cmd " [15 .0,16 .0)"
279279if " _%VCINSTALLDIR% _" == " __" goto msbuild-not-found
280280if defined msi (
281- echo Looking for WiX installation for Visual Studio 2019 ...
281+ echo Looking for WiX installation for Visual Studio 2017 ...
282282 if not exist " %WIX% \SDK\VS2017" (
283- echo Failed to find WiX install for Visual Studio 2019
284- echo VS2019 support for WiX is only present starting at version 3.11
283+ echo Failed to find WiX install for Visual Studio 2017
284+ echo VS2017 support for WiX is only present starting at version 3.11
285285 goto msbuild-not-found
286286 )
287287 if not exist " %VCINSTALLDIR% \..\MSBuild\Microsoft\WiX" (
288- echo Failed to find the WiX Toolset Visual Studio 2019 Extension
288+ echo Failed to find the WiX Toolset Visual Studio 2017 Extension
289289 goto msbuild-not-found
290290 )
291291)
292- @ rem check if VS2019 is already setup, and for the requested arch
293- if " _%VisualStudioVersion% _" == " _16 .0_" if " _%VSCMD_ARG_TGT_ARCH% _" == " _%target_arch% _" goto found_vs2019
292+ @ rem check if VS2017 is already setup, and for the requested arch
293+ if " _%VisualStudioVersion% _" == " _15 .0_" if " _%VSCMD_ARG_TGT_ARCH% _" == " _%target_arch% _" goto found_vs2017
294294@ rem need to clear VSINSTALLDIR for vcvarsall to work as expected
295295set " VSINSTALLDIR = "
296296@ rem prevent VsDevCmd.bat from changing the current working directory
@@ -300,10 +300,10 @@ echo calling: %vcvars_call%
300300call %vcvars_call%
301301if errorlevel 1 goto msbuild-not-found
302302if defined DEBUG_HELPER @ ECHO ON
303- :found_vs2019
303+ :found_vs2017
304304echo Found MSVS version %VisualStudioVersion%
305- set GYP_MSVS_VERSION = 2019
306- set PLATFORM_TOOLSET = v142
305+ set GYP_MSVS_VERSION = 2017
306+ set PLATFORM_TOOLSET = v141
307307goto msbuild-found
308308
309309:msbuild-not-found
0 commit comments