Skip to content

Commit

Permalink
Add support for VS 2022
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelgsharp committed Oct 5, 2021
1 parent be2ad61 commit 67e6e47
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/building/windows-instructions.md
Expand Up @@ -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.
Expand Down
16 changes: 15 additions & 1 deletion src/Native/build.cmd
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 67e6e47

Please sign in to comment.