Skip to content

Commit f183272

Browse files
committed
Fix VS2022 msbuild detection.
1 parent 5c4420c commit f183272

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

install_script.bat

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ if not ERRORLEVEL 1 (
267267
set /p MSBUILDDIR=<"%SCRIPTDIR%\msbuild.txt"
268268
del /F /Q "%SCRIPTDIR%\msbuild.txt" >nul 2>&1
269269
if "%MSVC_VER%"=="17" (
270-
set VCTargetsPath="..\..\Microsoft\VC\v170\BuildCustomizations"
270+
set VCTargetsPath="..\..\..\Microsoft\VC\v170\BuildCustomizations"
271271
) else if "%MSVC_VER%"=="16" (
272272
set VCTargetsPath="..\..\Microsoft\VC\v160\BuildCustomizations"
273273
) else if "%MSVC_VER%"=="15" (
@@ -282,8 +282,16 @@ if "%MSVC_VER%"=="17" (
282282

283283
REM Convert the relative targets path to an absolute one
284284
set CURRDIR=%CD%
285-
pushd %MSBUILDDIR%
286-
pushd %VCTargetsPath%
285+
pushd %MSBUILDDIR% 2>nul
286+
if %ERRORLEVEL% neq 0 (
287+
echo Error: Failed to get correct msbuild path!
288+
goto Terminate
289+
)
290+
pushd %VCTargetsPath% 2>nul
291+
if %ERRORLEVEL% neq 0 (
292+
echo Error: Unknown VCTargetsPath path!
293+
goto Terminate
294+
)
287295
set VCTargetsPath=%CD%
288296
popd
289297
popd

0 commit comments

Comments
 (0)