Skip to content

Commit

Permalink
Detect VS2017 in the run script
Browse files Browse the repository at this point in the history
  • Loading branch information
weshaggard committed Jul 25, 2017
1 parent 35d03ba commit d1cbf92
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 18 deletions.
19 changes: 11 additions & 8 deletions run.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,22 @@ setlocal
:: is already configured to use that toolset. Otherwise, we will fallback to using the VS2015
:: toolset if it is installed. Finally, we will fail the script if no supported VS instance
:: can be found.
if not defined VisualStudioVersion (
if defined VS150COMNTOOLS (
call "%VS150COMNTOOLS%\VsDevCmd.bat"
goto :Run
) else if defined VS140COMNTOOLS (
call "%VS140COMNTOOLS%\VsDevCmd.bat"
goto :Run
)

if defined VisualStudioVersion goto :Run

set _VSWHERE="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
if exist %_VSWHERE% (
for /f "usebackq tokens=*" %%i in (`%_VSWHERE% -latest -property installationPath`) do set _VSCOMNTOOLS=%%i\Common7\Tools
)
if not exist "%_VSCOMNTOOLS%" set _VSCOMNTOOLS=%VS140COMNTOOLS%
if not exist "%_VSCOMNTOOLS%" (
echo Error: Visual Studio 2015 or 2017 required.
echo Please see https://github.com/dotnet/corefx/blob/master/Documentation/project-docs/developer-guide.md for build instructions.
exit /b 1
)

call "%_VSCOMNTOOLS%\VsDevCmd.bat"

:Run
:: Clear the 'Platform' env variable for this session, as it's a per-project setting within the build, and
:: misleading value (such as 'MCD' in HP PCs) may lead to build breakage (issue: #69).
Expand Down
22 changes: 12 additions & 10 deletions src/Native/build-native.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,19 @@ goto :Arg_Loop
:: is already configured to use that toolset. Otherwise, we will fallback to using the VS2015
:: toolset if it is installed. Finally, we will fail the script if no supported VS instance
:: can be found.
if not defined VisualStudioVersion (
if defined VS150COMNTOOLS (
call "%VS150COMNTOOLS%VsDevCmd.bat"
goto :VS2017
) else if defined VS140COMNTOOLS (
call "%VS140COMNTOOLS%VsDevCmd.bat"
goto :VS2015
)
goto :MissingVersion

if defined VisualStudioVersion goto :RunVCVars

set _VSWHERE="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
if exist %_VSWHERE% (
for /f "usebackq tokens=*" %%i in (`%_VSWHERE% -latest -property installationPath`) do set _VSCOMNTOOLS=%%i\Common7\Tools
)
if not exist "%_VSCOMNTOOLS%" set _VSCOMNTOOLS=%VS140COMNTOOLS%
if not exist "%_VSCOMNTOOLS%" goto :MissingVersion

call "%_VSCOMNTOOLS%\VsDevCmd.bat"

:RunVCVars
if "%VisualStudioVersion%"=="15.0" (
goto :VS2017
) else if "%VisualStudioVersion%"=="14.0" (
Expand All @@ -72,7 +74,7 @@ if "%VisualStudioVersion%"=="15.0" (

:MissingVersion
:: Can't find VS 2015 or 2017
echo Error: Visual Studio 2015 or 2017 required
echo Error: Visual Studio 2015 or 2017 required
echo Please see https://github.com/dotnet/corefx/tree/master/Documentation for build instructions.
exit /b 1

Expand Down

0 comments on commit d1cbf92

Please sign in to comment.