Skip to content

Commit deb50d9

Browse files
committed
install_script: Improve vswhere detection.
1 parent ddc8e1f commit deb50d9

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

install_script.bat

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -77,26 +77,24 @@ if not exist "%SCRIPTDIR%\vswhere.exe" (
7777

7878
:VSwhereDetection
7979
REM Use vswhere to list detected installs
80-
for /f "usebackq tokens=1* delims=: " %%i in (`"%SCRIPTDIR%\vswhere.exe" -prerelease -requires Microsoft.Component.MSBuild`) do (
81-
if /i "%%i"=="installationPath" (
82-
for /f "delims=" %%a in ('echo %%j ^| find "2019"') do (
83-
if not "%%a"=="" (
84-
echo Visual Studio 2019 environment detected...
85-
call "%~0" "16" "%%j"
86-
if not ERRORLEVEL 1 (
87-
set MSVC16=1
88-
set MSVCFOUND=1
89-
)
80+
for /f "usebackq tokens=1* delims=: " %%i in (`"%SCRIPTDIR%\vswhere.exe" -prerelease -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do (
81+
for /f "delims=" %%a in ('echo %%j ^| find "2019"') do (
82+
if not "%%a"=="" (
83+
echo Visual Studio 2019 environment detected...
84+
call "%~0" "16" "%%j"
85+
if not ERRORLEVEL 1 (
86+
set MSVC16=1
87+
set MSVCFOUND=1
9088
)
9189
)
92-
for /f "delims=" %%a in ('echo %%j ^| find "2017"') do (
93-
if not "%%a"=="" (
94-
echo Visual Studio 2017 environment detected...
95-
call "%~0" "15" "%%j"
96-
if not ERRORLEVEL 1 (
97-
set MSVC15=1
98-
set MSVCFOUND=1
99-
)
90+
)
91+
for /f "delims=" %%a in ('echo %%j ^| find "2017"') do (
92+
if not "%%a"=="" (
93+
echo Visual Studio 2017 environment detected...
94+
call "%~0" "15" "%%j"
95+
if not ERRORLEVEL 1 (
96+
set MSVC15=1
97+
set MSVCFOUND=1
10098
)
10199
)
102100
)

0 commit comments

Comments
 (0)