From 9835638f238ba7701ecb25f41f013302f5f0148d Mon Sep 17 00:00:00 2001 From: Michael Sharp Date: Mon, 4 Oct 2021 17:22:41 -0700 Subject: [PATCH 1/2] Added in VS 2022 support --- docs/building/windows-instructions.md | 2 +- src/Native/build.cmd | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/building/windows-instructions.md b/docs/building/windows-instructions.md index 40eb762812..336ca896e8 100644 --- a/docs/building/windows-instructions.md +++ b/docs/building/windows-instructions.md @@ -6,7 +6,7 @@ You can build ML.NET either via the command line or by using Visual Studio. ## Required Software 1. **[Visual Studio 2019 Version 16.4+](https://www.visualstudio.com/downloads/) (Community, Professional, Enterprise)** The Community version is completely free. The below build instructions were verified for VS 16.4. -2. **[CMake](https://cmake.org/)** must be installed from [the CMake download page](https://cmake.org/download/#latest) and added to your path. +2. **[CMake](https://cmake.org/)** must be installed from [the CMake download page](https://cmake.org/download/#latest) and added to your path. If you want to use Visual Studio 2022, you need to be using at least CMake 3.21. ### Visual Studio 2019 Installation We have successfully verified the below build instructions for Visual Studio version 16.4 and higher. diff --git a/src/Native/build.cmd b/src/Native/build.cmd index f4e6592e31..cd45e1d1d7 100644 --- a/src/Native/build.cmd +++ b/src/Native/build.cmd @@ -51,7 +51,9 @@ set "VSCMD_START_DIR=%__currentScriptDir%" call "%_VSCOMNTOOLS%\VsDevCmd.bat" :RunVCVars -if "%VisualStudioVersion%"=="16.0" ( +if "%VisualStudioVersion%"=="17.0" ( + goto :VS2022 +) else if "%VisualStudioVersion%"=="16.0" ( goto :VS2019 ) else if "%VisualStudioVersion%"=="15.0" ( goto :VS2017 @@ -65,6 +67,14 @@ echo Error: Visual Studio 2015, 2017 or 2019 required echo Please see https://github.com/dotnet/machinelearning/tree/main/Documentation for build instructions. exit /b 1 +:VS2022 +:: Setup vars for VS2019 +set __PlatformToolset=v143 +set __VSVersion=17 2022 +:: Set the environment for the native build +call "%VS170COMNTOOLS%..\..\VC\Auxiliary\Build\vcvarsall.bat" %__VCBuildArch% + +goto :SetupDirs :VS2019 :: Setup vars for VS2019 set __PlatformToolset=v142 From a4d6ad7c6535da8dd0af301dc28efa423ff517e4 Mon Sep 17 00:00:00 2001 From: Michael Sharp <51342856+michaelgsharp@users.noreply.github.com> Date: Mon, 4 Oct 2021 20:05:02 -0700 Subject: [PATCH 2/2] Update build.cmd --- src/Native/build.cmd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Native/build.cmd b/src/Native/build.cmd index cd45e1d1d7..d1f29aa512 100644 --- a/src/Native/build.cmd +++ b/src/Native/build.cmd @@ -62,13 +62,13 @@ if "%VisualStudioVersion%"=="17.0" ( ) :MissingVersion -:: Can't find VS 2015, 2017 or 2019 -echo Error: Visual Studio 2015, 2017 or 2019 required +:: Can't find VS 2015, 2017, 2019, or 2022 +echo Error: Visual Studio 2015, 2017, 2019, or 2022 required echo Please see https://github.com/dotnet/machinelearning/tree/main/Documentation for build instructions. exit /b 1 :VS2022 -:: Setup vars for VS2019 +:: Setup vars for VS2022 set __PlatformToolset=v143 set __VSVersion=17 2022 :: Set the environment for the native build