Updating the build scripts to support VS2017.
[platform/upstream/coreclr.git] / run.cmd
1 @if not defined _echo @echo off
2 setlocal
3
4 if not defined VisualStudioVersion (
5   if defined VS150COMNTOOLS (
6          if not exist "%VS150COMNTOOLS%\..\IDE\devenv.exe"      goto NoVS
7          if not exist "%VS150COMNTOOLS%\..\..\VC\Auxiliary\Build\vcvarsall.bat" goto NoVS
8          if not exist "%VS150COMNTOOLS%\VsDevCmd.bat"                     goto NoVS
9     call "%VS150COMNTOOLS%\VsDevCmd.bat"
10     goto :Run
11   ) else if defined VS140COMNTOOLS (
12          if not exist "%VS140COMNTOOLS%\..\IDE\devenv.exe"      goto NoVS
13          if not exist "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" goto NoVS
14          if not exist "%VS140COMNTOOLS%\VsDevCmd.bat"                     goto NoVS
15     call "%VS140COMNTOOLS%\VsDevCmd.bat"
16     goto :Run
17   )
18
19   :NoVS
20   echo Error: Visual Studio 2015 or 2017 required.
21   echo        https://github.com/dotnet/coreclr/blob/master/Documentation/building/windows-instructions.md for build instructions.
22   exit /b 1
23 )
24
25 :Run
26 :: Clear the 'Platform' env variable for this session, as it's a per-project setting within the build, and
27 :: misleading value (such as 'MCD' in HP PCs) may lead to build breakage (issue: #69).
28 set Platform=
29
30 :: Restore the Tools directory
31 call %~dp0init-tools.cmd
32 if NOT [%ERRORLEVEL%]==[0] (
33   exit /b 1
34 )
35
36 set _toolRuntime=%~dp0Tools
37 set _dotnet=%_toolRuntime%\dotnetcli\dotnet.exe
38
39 echo Running: %_dotnet% %_toolRuntime%\run.exe %~dp0config.json %*
40 call %_dotnet% %_toolRuntime%\run.exe %~dp0config.json %*
41 if NOT [%ERRORLEVEL%]==[0] (
42   exit /b 1
43 )
44
45 exit /b 0