[Tizen] Add method to write coredump of .NET process (#317)
[platform/upstream/coreclr.git] / setup_vs_tools.cmd
1 @if not defined _echo @echo off
2
3 REM This script is responsible for setting up the vs2017 or vs2019 env
4 REM All passed arguments are ignored
5 REM Script will return with 0 if pass, 1 if there is a failure to find either
6 REM vs2017 or vs2019
7
8 :: Default to highest Visual Studio version available
9 ::
10 :: For VS2017 and later, multiple instances can be installed on the same box SxS and VS1*0COMNTOOLS
11 :: is no longer set as a global environment variable and is instead only set if the user
12 :: has launched the Visual Studio Developer Command Prompt.
13 ::
14 :: Following this logic, we will default to the Visual Studio toolset assocated with the active
15 :: Developer Command Prompt. Otherwise, we will query VSWhere to locate the later version of
16 :: Visual Studio available on the machine. Finally, we will fail the script if not supported
17 :: instance can be found.
18
19 if defined VisualStudioVersion (
20     if not defined __VSVersion echo %__MsgPrefix%Detected Visual Studio %VisualStudioVersion% developer command ^prompt environment
21     goto skip_setup
22 )
23
24 echo %__MsgPrefix%Searching ^for Visual Studio 2017 or later installation
25 set _VSWHERE="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
26 if exist %_VSWHERE% (
27     for /f "usebackq tokens=*" %%i in (`%_VSWHERE% -latest -prerelease -property installationPath`) do set _VSCOMNTOOLS=%%i\Common7\Tools
28     goto call_vs
29 )
30 echo Visual Studio 2017 or later not found
31 :call_vs
32 if not exist "%_VSCOMNTOOLS%" (
33     echo %__MsgPrefix%Error: Visual Studio 2017 or 2019 required.
34     echo        Please see https://github.com/dotnet/coreclr/blob/master/Documentation/building/windows-instructions.md for build instructions.
35     exit /b 1
36 )
37 echo %__MsgPrefix%"%_VSCOMNTOOLS%\VsDevCmd.bat"
38 call "%_VSCOMNTOOLS%\VsDevCmd.bat"
39
40 :skip_setup
41
42 exit /b 0