Microsoft.Windows.AI.MachineLearning 2.9.42-experimental

Using Microsoft.Windows.AI.MachineLearning

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

This package includes ONNX Runtime 1.30.1.

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

To omit DirectML.dll from MSBuild output when the application does not use the ONNX Runtime DML execution provider:

<PropertyGroup>
  <WinMLCopyDirectML>false</WinMLCopyDirectML>
</PropertyGroup>

The property defaults to true. CGC-enabled packages always deploy DirectML because dxcgc.dll requires it.

The opt-out prevents new copies of DirectML from this package; it does not guarantee removal of a DLL copied by an earlier build. After changing the option, use a fresh build or deployment output directory to avoid retaining stale files. Preserve any DirectML deployment supplied by your application or another dependency.

Packages that include ONNX-to-CGC compilation also deploy FoundryToolbox.dll, the compiler IWinMLModelCompiler loads to compile ONNX models for a CGC execution target. To omit it when the application does not compile ONNX models for a CGC execution target:

<PropertyGroup>
  <WinMLCopyFoundryToolbox>false</WinMLCopyFoundryToolbox>
</PropertyGroup>

Without it, a device-targeted compile of an ONNX model for a CGC execution target returns HRESULT_FROM_WIN32(ERROR_MOD_NOT_FOUND), and IsCompiledModelFormSupported reports the durable form unsupported (a durable request returns HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED)). Loading and running compiled models is unaffected. The same stale-output guidance applies.

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

Showing the top 20 packages that depend on Microsoft.Windows.AI.MachineLearning.

Packages Downloads
Microsoft.WindowsAppSDK.ML
The Windows App SDK empowers all Windows Desktop apps with modern Windows UI, APIs, and platform features, including back-compat support. This package contains the Windows Machine Learning APIs.
8
Microsoft.WindowsAppSDK.ML
The Windows App SDK empowers all Windows Desktop apps with modern Windows UI, APIs, and platform features, including back-compat support. This package contains the Windows Machine Learning APIs.
7
Microsoft.WindowsAppSDK.ML
The Windows App SDK empowers all Windows Desktop apps with modern Windows UI, APIs, and platform features, including back-compat support. This package contains the Windows Machine Learning APIs.
6
Microsoft.WindowsAppSDK.ML
The Windows App SDK empowers all Windows Desktop apps with modern Windows UI, APIs, and platform features, including back-compat support. This package contains the Windows Machine Learning APIs.
5
Microsoft.WindowsAppSDK.ML
The Windows App SDK empowers all Windows Desktop apps with modern Windows UI, APIs, and platform features, including back-compat support. This package contains the Windows Machine Learning APIs.
4
Microsoft.WindowsAppSDK.ML
The Windows App SDK empowers all Windows Desktop apps with modern Windows UI, APIs, and platform features, including back-compat support. This package contains the Windows Machine Learning APIs.
3
Microsoft.WindowsAppSDK.ML
The Windows App SDK empowers all Windows Desktop apps with modern Windows UI, APIs, and platform features, including back-compat support. This package contains the Windows Machine Learning APIs.
2

.NET 6.0

.NET 8.0

native 0.0

Version Downloads Last updated
2.9.42-experimental 2 11/23/2026
2.9.36-experimental 2 11/22/2026
2.7.2021-experimental 2 10/31/2026
2.6.74-rc 5 09/22/2026
2.5.96 2 11/02/2026
2.5.83-rc 4 09/29/2026
2.5.77-rc 5 09/22/2026
2.4.89 4 09/29/2026
2.4.66-preview 6 07/24/2026
2.3.42 5 09/22/2026
2.3.10-preview 6 07/24/2026
2.2.12 5 09/22/2026
2.1.75-experimental 9 06/15/2026
2.1.74 6 07/24/2026
2.1.71 8 06/17/2026
2.1.70 8 06/17/2026
2.1.6 7 06/17/2026
2.1.3-experimental 8 05/20/2026
2.1.1 8 05/20/2026
2.0.325-experimental 9 04/28/2026
2.0.300 10 05/05/2026
2.0.297-preview 10 04/28/2026