From 79bb56e0d9d0f3847d1e5cb8d58fa3a0b9dbbc88 Mon Sep 17 00:00:00 2001 From: Tanner Gooding Date: Tue, 7 Mar 2017 18:04:25 -0800 Subject: [PATCH] Updating the various windows build scripts to have a comment explaining the VS version selection logic. Commit migrated from https://github.com/dotnet/coreclr/commit/d6158c82c37c72a9af96d5b51139a821b8071f1c --- src/coreclr/build-test.cmd | 14 ++++++++++++++ src/coreclr/build.cmd | 14 ++++++++++++++ src/coreclr/run.cmd | 15 +++++++++++++++ src/coreclr/tests/runtest.cmd | 14 ++++++++++++++ 4 files changed, 57 insertions(+) diff --git a/src/coreclr/build-test.cmd b/src/coreclr/build-test.cmd index f0d1def..7c91b62 100644 --- a/src/coreclr/build-test.cmd +++ b/src/coreclr/build-test.cmd @@ -8,6 +8,20 @@ set __BuildType=Debug set __BuildOS=Windows_NT :: Default to highest Visual Studio version available +:: +:: For VS2015 (and prior), only a single instance is allowed to be installed on a box +:: and VS140COMNTOOLS is set as a global environment variable by the installer. This +:: allows users to locate where the instance of VS2015 is installed. +:: +:: For VS2017, multiple instances can be installed on the same box SxS and VS150COMNTOOLS +:: is no longer set as a global environment variable and is instead only set if the user +:: has launched the VS2017 Developer Command Prompt. +:: +:: Following this logic, we will default to the VS2017 toolset if VS150COMNTOOLS tools is +:: set, as this indicates the user is running from the VS2017 Developer Command Prompt and +:: 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 defined VS150COMNTOOLS ( set "__VSToolsRoot=%VS150COMNTOOLS%" set "__VCToolsRoot=%VS150COMNTOOLS%\..\..\VC\Auxiliary\Build" diff --git a/src/coreclr/build.cmd b/src/coreclr/build.cmd index 90418a0..eb734e3 100644 --- a/src/coreclr/build.cmd +++ b/src/coreclr/build.cmd @@ -5,6 +5,20 @@ echo Starting Build at %TIME% set __ThisScriptFull="%~f0" :: Default to highest Visual Studio version available +:: +:: For VS2015 (and prior), only a single instance is allowed to be installed on a box +:: and VS140COMNTOOLS is set as a global environment variable by the installer. This +:: allows users to locate where the instance of VS2015 is installed. +:: +:: For VS2017, multiple instances can be installed on the same box SxS and VS150COMNTOOLS +:: is no longer set as a global environment variable and is instead only set if the user +:: has launched the VS2017 Developer Command Prompt. +:: +:: Following this logic, we will default to the VS2017 toolset if VS150COMNTOOLS tools is +:: set, as this indicates the user is running from the VS2017 Developer Command Prompt and +:: 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 defined VS150COMNTOOLS ( set "__VSToolsRoot=%VS150COMNTOOLS%" set "__VCToolsRoot=%VS150COMNTOOLS%\..\..\VC\Auxiliary\Build" diff --git a/src/coreclr/run.cmd b/src/coreclr/run.cmd index 3e07bf1..450927b 100644 --- a/src/coreclr/run.cmd +++ b/src/coreclr/run.cmd @@ -1,6 +1,21 @@ @if not defined _echo @echo off setlocal +:: Default to highest Visual Studio version available +:: +:: For VS2015 (and prior), only a single instance is allowed to be installed on a box +:: and VS140COMNTOOLS is set as a global environment variable by the installer. This +:: allows users to locate where the instance of VS2015 is installed. +:: +:: For VS2017, multiple instances can be installed on the same box SxS and VS150COMNTOOLS +:: is no longer set as a global environment variable and is instead only set if the user +:: has launched the VS2017 Developer Command Prompt. +:: +:: Following this logic, we will default to the VS2017 toolset if VS150COMNTOOLS tools is +:: set, as this indicates the user is running from the VS2017 Developer Command Prompt and +:: 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 ( if not exist "%VS150COMNTOOLS%\..\IDE\devenv.exe" goto NoVS diff --git a/src/coreclr/tests/runtest.cmd b/src/coreclr/tests/runtest.cmd index 9f07e03..e54349c 100644 --- a/src/coreclr/tests/runtest.cmd +++ b/src/coreclr/tests/runtest.cmd @@ -8,6 +8,20 @@ set __BuildOS=Windows_NT set __MSBuildBuildArch=x64 :: Default to highest Visual Studio version available +:: +:: For VS2015 (and prior), only a single instance is allowed to be installed on a box +:: and VS140COMNTOOLS is set as a global environment variable by the installer. This +:: allows users to locate where the instance of VS2015 is installed. +:: +:: For VS2017, multiple instances can be installed on the same box SxS and VS150COMNTOOLS +:: is no longer set as a global environment variable and is instead only set if the user +:: has launched the VS2017 Developer Command Prompt. +:: +:: Following this logic, we will default to the VS2017 toolset if VS150COMNTOOLS tools is +:: set, as this indicates the user is running from the VS2017 Developer Command Prompt and +:: 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. set __VSVersion=vs2017 if defined VS140COMNTOOLS set __VSVersion=vs2015 -- 2.7.4