Microsoft.Windows.AI.MachineLearning 2.0.297-preview

Prefix Reserved
This is a prerelease version of Microsoft.Windows.AI.MachineLearning.
dotnet add package Microsoft.Windows.AI.MachineLearning --version 2.0.297-preview
                    
NuGet\Install-Package Microsoft.Windows.AI.MachineLearning -Version 2.0.297-preview
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Microsoft.Windows.AI.MachineLearning" Version="2.0.297-preview" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Microsoft.Windows.AI.MachineLearning" Version="2.0.297-preview" />
                    
Directory.Packages.props
<PackageReference Include="Microsoft.Windows.AI.MachineLearning" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Microsoft.Windows.AI.MachineLearning --version 2.0.297-preview
                    
#r "nuget: Microsoft.Windows.AI.MachineLearning, 2.0.297-preview"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Microsoft.Windows.AI.MachineLearning@2.0.297-preview
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Microsoft.Windows.AI.MachineLearning&version=2.0.297-preview&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Microsoft.Windows.AI.MachineLearning&version=2.0.297-preview&prerelease
                    
Install as a Cake Tool

Using Microsoft.Windows.AI.MachineLearning

The Microsoft.Windows.AI.MachineLearning package provides Windows Machine Learning APIs for on-device AI inference using ONNX Runtime.

Requirements

  • Minimum OS: Windows 10 19H1 (build 18362) or later.
  • For Windows 10 versions prior to 19H1 (build 18362), use the Microsoft.WindowsAppSDK.ML package instead, which provides framework-based deployment via the Windows App SDK runtime.

Getting Started

Add a reference to Microsoft.Windows.AI.MachineLearning in your project. No additional configuration is required for unpackaged apps on Windows 10 19H1+ and Windows 11.

Native C++

#include <winrt/Microsoft.Windows.AI.MachineLearning.h>

.NET

using Microsoft.Windows.AI.MachineLearning;

Deployment

Binaries are deployed alongside your application:

MyApp/
├── MyApp.exe
├── Microsoft.Windows.AI.MachineLearning.dll
├── onnxruntime.dll
└── DirectML.dll

WinRT activation relies on OS-native reg-free WinRT, available on Windows 10 19H1+.

Using ONNX Runtime Headers

The ONNX Runtime headers are included in a winml subdirectory:

#include <winml/onnxruntime_c_api.h>
#include <winml/onnxruntime_cxx_api.h>

To use headers without the winml/ prefix:

<PropertyGroup>
  <WinMLEnableDefaultOrtHeaderIncludePath>true</WinMLEnableDefaultOrtHeaderIncludePath>
</PropertyGroup>

WindowsAppSDK Integration

For WindowsAppSDK consumers or packaged (MSIX) applications, use Microsoft.WindowsAppSDK.ML instead. It depends on this package transitively and provides additional integration with the Windows App SDK runtime.

More Information

Product Compatible and additional computed target framework versions.
.NET net6.0-windows10.0.17763 is compatible.  net7.0-windows was computed.  net8.0-windows was computed.  net8.0-windows10.0.17763 is compatible.  net9.0-windows was computed.  net10.0-windows was computed. 
native native is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on Microsoft.Windows.AI.MachineLearning:

Repository Stars
microsoft/ai-dev-gallery
An open-source project for Windows developers to learn how to add AI with local models and APIs to Windows apps.
Version Downloads Last Updated
2.0.297-preview 53 3/26/2026