diff --git a/docs/building/windows-instructions.md b/docs/building/windows-instructions.md index 40eb762812e..336ca896e8c 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 f4e6592e311..0d2486f1cae 100644 --- a/src/Native/build.cmd +++ b/src/Native/build.cmd @@ -51,7 +51,11 @@ set "VSCMD_START_DIR=%__currentScriptDir%" call "%_VSCOMNTOOLS%\VsDevCmd.bat" :RunVCVars -if "%VisualStudioVersion%"=="16.0" ( +echo "%VisualStudioVersion%" +echo "HERE" +if "%VisualStudioVersion%"=="17.0" ( + goto :VS2022 +) else if "%VisualStudioVersion%"=="16.0" ( goto :VS2019 ) else if "%VisualStudioVersion%"=="15.0" ( goto :VS2017 @@ -65,6 +69,16 @@ 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