corert icon indicating copy to clipboard operation
corert copied to clipboard

buildvars-setup.cmd will fail because CheckMSBuild used before its defined

Open RileyCodes opened this issue 5 years ago • 1 comments

buildvars-setup.cmd:156 goto :CheckMSBuild is not working in my environment

a simple fix would be move :MissingVisualC and :CheckMSBuild on top of :VS2017

:MissingVisualC
echo Could not find Visual C++ under !VS%__VSProductVersion%COMNTOOLS!. Visual C++ is a pre-requisite to build this repository.
echo See: https://github.com/dotnet/corert/blob/master/Documentation/prerequisites-for-building.md
exit /b 1

:CheckMSBuild
if not exist !_msbuildexe! (echo Error: Could not find MSBuild.exe.  Please see https://github.com/dotnet/corert/blob/master/Documentation/prerequisites-for-building.md for build instructions. && exit /b 1)


 
:VS2017
:: Setup vars for VS2017
set __VSVersion=vs2017
set __VSProductVersion=150
if not exist "%VSINSTALLDIR%\VC\Auxiliary\Build\vcvarsall.bat" goto :MissingVisualC
set _msbuildexe="%VSINSTALLDIR%\MSBuild\15.0\Bin\MSBuild.exe"
goto :CheckMSBuild

:VS2019
:: Setup vars for VS2019
set __VSVersion=vs2019
set __VSProductVersion=160
if not exist "%VSINSTALLDIR%\VC\Auxiliary\Build\vcvarsall.bat" goto :MissingVisualC
set _msbuildexe="%VSINSTALLDIR%\MSBuild\Current\Bin\MSBuild.exe"
goto :CheckMSBuild



RileyCodes avatar May 26 '20 12:05 RileyCodes

Not sure that the reason this could be failing is because of the order. The following batch is valid:

GOTO END
ECHO SKIPPING THIS
:END
ECHO DONE

Maybe you could post the output of what happens?

yowl avatar Jun 03 '20 19:06 yowl