Enable building this repo with VS2017
authorWes Haggard <Wes.Haggard@microsoft.com>
Wed, 26 Jul 2017 16:52:03 +0000 (09:52 -0700)
committerWes Haggard <Wes.Haggard@microsoft.com>
Wed, 26 Jul 2017 16:52:03 +0000 (09:52 -0700)
Commit migrated from https://github.com/dotnet/core-setup/commit/9a20b39067a7fcb979c7421e97c081f8544ae187

src/installer/corehost/build.cmd
src/installer/run.cmd
src/installer/run.ps1
src/installer/uwp/build.cmd

index 8a5fadf..71d0def 100644 (file)
@@ -41,32 +41,49 @@ shift
 goto :Arg_Loop
 
 :ToolsVersion
-:: Determine the tools version to pass to cmake/msbuild
-if not defined VisualStudioVersion (
-    if defined VS140COMNTOOLS (
-        goto :VS2015
-    ) 
-    goto :MissingVersion
-) 
-if "%VisualStudioVersion%"=="14.0" (
+
+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" (
     goto :VS2015
-) 
+)
 
 :MissingVersion
-:: Can't find VS 2013+
-echo Error: Visual Studio 2015 required  
-echo        Please see https://github.com/dotnet/corefx/blob/master/Documentation/project-docs/developer-guide.md for build instructions.
+:: Can't find VS 2015 or 2017
+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
 
+:VS2017
+:: Setup vars for VS2017
+set __VSVersion=vs2017
+set __PlatformToolset=v141
+if NOT "%__BuildArch%" == "arm64" (
+    :: Set the environment for the native build
+    call "%VS150COMNTOOLS%..\..\VC\Auxiliary\Build\vcvarsall.bat" %__VCBuildArch%
+)
+goto :SetupDirs
+
 :VS2015
-:: Setup vars for VS2015
+:: Setup vars for VS2015build
 set __VSVersion=vs2015
 set __PlatformToolset=v140
-if NOT "%__BuildArch%" == "arm64" ( 
+if NOT "%__BuildArch%" == "arm64" (
     :: Set the environment for the native build
-    call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" %__VCBuildArch%
+    call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" %__VCBuildArch%
 )
-goto :SetupDirs
 
 :SetupDirs
 :: Setup to cmake the native components
@@ -102,7 +119,7 @@ exit /b 1
 :GenVSSolution
 :: Regenerate the VS solution
 
-if /i "%__BuildArch%" == "arm64" ( 
+if /i "%__BuildArch%" == "arm64" (
     REM arm64 builds currently use private toolset which has not been released yet
     REM TODO, remove once the toolset is open.
     call :PrivateToolSet
index 2f52e07..b513914 100644 (file)
@@ -1,16 +1,21 @@
 @if "%_echo%" neq "on" echo off
 setlocal
 
-if not defined VisualStudioVersion (
-  if defined VS140COMNTOOLS (
-    call "%VS140COMNTOOLS%\VsDevCmd.bat"
-    goto :Run
-  )
-  echo Error: Visual Studio 2015 required.
-  echo        Please see https://github.com/dotnet/core-setup/blob/master/Documentation/building/windows-instructions.md for build instructions.
+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
 :: We do not want to run the first-time experience.
 set DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
index c7cbb8d..5363d4f 100644 (file)
@@ -8,5 +8,6 @@ $initTools = Join-Path $PSScriptRoot "init-tools.cmd"
 # execute the tool using the dotnet.exe host
 $dotNetExe = Join-Path $toolsLocalPath "dotnetcli\dotnet.exe"
 $runExe = Join-Path $toolsLocalPath "run.exe"
-& $dotNetExe $runExe $args
+$runConfig = Join-Path $PSScriptRoot "config.json"
+& $dotNetExe $runExe $runConfig $args
 exit $LastExitCode
\ No newline at end of file
index 96316b9..92a6387 100644 (file)
@@ -32,30 +32,48 @@ shift
 goto :Arg_Loop
 
 :ToolsVersion
-:: Determine the tools version to pass to cmake/msbuild
-if not defined VisualStudioVersion (
-    if defined VS140COMNTOOLS (
-        goto :VS2015
-    ) 
-    goto :MissingVersion
-) 
-if "%VisualStudioVersion%"=="14.0" (
+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" (
     goto :VS2015
-) 
+)
 
 :MissingVersion
-:: Can't find VS 2013+
-echo Error: Visual Studio 2015 required  
-echo        Please see https://github.com/dotnet/corefx/blob/master/Documentation/project-docs/developer-guide.md for build instructions.
+:: Can't find VS 2015 or 2017
+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
 
+:VS2017
+:: Setup vars for VS2017
+set __VSVersion=vs2017
+set __PlatformToolset=v141
+if NOT "%__BuildArch%" == "arm64" (
+    :: Set the environment for the native build
+    call "%VS150COMNTOOLS%..\..\VC\Auxiliary\Build\vcvarsall.bat" %__VCBuildArch%
+)
+goto :SetupDirs
+
 :VS2015
-:: Setup vars for VS2015
+:: Setup vars for VS2015build
 set __VSVersion=vs2015
 set __PlatformToolset=v140
-
-:: Set the environment for the native build
-call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" %__VCBuildArch%
+if NOT "%__BuildArch%" == "arm64" (
+    :: Set the environment for the native build
+    call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" %__VCBuildArch%
+)
 
 :SetupDirs
 :: Setup to cmake the native components