|
1 | 1 | @echooff |
2 | 2 |
|
| 3 | +:: Try find installation path of VS2017 with vswhere.exe |
| 4 | +if"%VS150COMNTOOLS%"EQU""ifexist"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\" ( |
| 5 | +for /f"usebackq delims="%%iin (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -prerelease -property installationPath`)dosetVS_INSTALLATION_PATH=%%i |
| 6 | +) |
| 7 | + |
| 8 | +if"%VS_INSTALLATION_PATH%"NEQ"" ( |
| 9 | +call"%VS_INSTALLATION_PATH%\Common7\Tools\VsDevCmd.bat" |
| 10 | +) |
| 11 | + |
| 12 | +:: If there's no installation of VS2017 or VS2017 Preview, use the build tools |
| 13 | +if"%VS150COMNTOOLS%"EQU""ifexist"%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools\Common7\Tools\VsDevCmd.bat" ( |
| 14 | +call"%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools\Common7\Tools\VsDevCmd.bat" |
| 15 | +) |
| 16 | + |
| 17 | +echo. |
| 18 | +echo Environment |
| 19 | +set |
| 20 | +echo. |
| 21 | +echo. |
| 22 | +:: Check prerequisites |
| 23 | +ifnot"%VisualStudioVersion%"==""goto vsversionset |
| 24 | +ifexist"%VS150COMNTOOLS%\..\ide\devenv.exe"setVisualStudioVersion=15.0 |
| 25 | +ifnot"%VisualStudioVersion%"==""goto vsversionset |
| 26 | + |
| 27 | +ifnot"%VisualStudioVersion%"==""goto vsversionset |
| 28 | +ifexist"%VS150COMNTOOLS%\..\..\ide\devenv.exe"setVisualStudioVersion=15.0 |
| 29 | +ifnot"%VisualStudioVersion%"==""goto vsversionset |
| 30 | + |
| 31 | +ifexist"%VS140COMNTOOLS%\..\ide\devenv.exe"setVisualStudioVersion=14.0 |
| 32 | +ifexist"%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\common7\ide\devenv.exe"setVisualStudioVersion=14.0 |
| 33 | +ifexist"%ProgramFiles%\Microsoft Visual Studio 14.0\common7\ide\devenv.exe"setVisualStudioVersion=14.0 |
| 34 | +ifnot"%VisualStudioVersion%"==""goto vsversionset |
| 35 | + |
| 36 | +ifexist"%VS120COMNTOOLS%\..\ide\devenv.exe"setVisualStudioVersion=12.0 |
| 37 | +ifexist"%ProgramFiles(x86)%\Microsoft Visual Studio 12.0\common7\ide\devenv.exe"setVisualStudioVersion=12.0 |
| 38 | +ifexist"%ProgramFiles%\Microsoft Visual Studio 12.0\common7\ide\devenv.exe"setVisualStudioVersion=12.0 |
| 39 | + |
| 40 | +:vsversionset |
| 41 | +if"%VisualStudioVersion%"==""echo Error: Could not find an installation of Visual Studio&&goto :failure |
| 42 | + |
3 | 43 | :: Check prerequisites |
4 | 44 | ifexist"%VS150COMNTOOLS%\..\..\MSBuild\15.0\Bin\MSBuild.exe" ( |
5 | 45 | set_msbuildexe="%VS150COMNTOOLS%\..\..\MSBuild\15.0\Bin\MSBuild.exe" |
|