Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Windows ML ships as part of the Windows App SDK and supports two deployment modes: framework-dependent (recommended) and self-contained. Choose based on your app's size, update, and dependency requirements.
To learn more about Windows ML, see What is Windows ML.
Quick start
Here's the short version of how to install Windows ML in your project:
For framework-dependent (recommended), install:
- Microsoft.WindowsAppSDK.ML
- Microsoft.WindowsAppSDK.Runtime
- Then, see Deployment for framework-dependent apps for how to deploy the runtime
For self-contained (increases app size by ~41 MB):
- For apps targeting Windows 10 Build 18362 or higher, install Microsoft.Windows.AI.MachineLearning
- Or, for apps targeting Windows 10 Build 17763 or higher, install Microsoft.WindowsAppSDK.ML
- Do not install
Microsoft.WindowsAppSDK.Runtimeor the mainMicrosoft.WindowsAppSDKpackage
For full details on each option, see the sections below.
Requirements
- .NET 8 or greater
- Target framework moniker
net8.0-windows10.0.17763.0or greater if using Microsoft.WindowsAppSDK.ML, or target framework monikernet8.0-windows10.0.18362.0or greater if using Microsoft.Windows.AI.MachineLearning
Note
With .NET 6, you can use the Microsoft.Windows.AI.MachineLearning namespace to install execution providers, but Microsoft.ML.OnnxRuntime APIs are not available. Upgrade to .NET 8 to access the full Windows ML API surface.
What's in Windows ML
Windows ML is composed of these binaries:
| Binary | Description | Approx. size |
|---|---|---|
Microsoft.Windows.AI.MachineLearning.dll |
Windows ML APIs (ExecutionProviderCatalog, etc.) |
~1 MB |
onnxruntime.dll |
The ONNX Runtime engine | ~20 MB |
DirectML.dll |
DirectML — the included GPU execution provider | ~20 MB |
| Total | ~41 MB |
Vendor execution providers (QNN, VitisAI, OpenVINO, NvTensorRtRtx, MIGraphX) are not part of Windows ML itself. They are obtained separately — either via the ExecutionProviderCatalog at runtime, or bundled yourself. See Accelerate AI models.
Choosing a deployment mode
When using Windows ML, you can choose between two deployment modes: framework-dependent (recommended) and self-contained.
| Framework-dependent (recommended) | Self-contained | |
|---|---|---|
| Supported languages | C#, C++/WinRT, Python | C#, C++/WinRT, C/C++ |
| Supported packaging types | Unpackaged and packaged (MSIX) | Unpackaged and packaged (MSIX) |
| Enterprise deployment | Supported | Supported |
| App size | Smaller — Windows ML binaries are shared system-wide | Larger — Windows ML binaries are bundled with your app (~41 MB) |
| Windows ML updates | Automatic — users get updates via Windows App SDK servicing | Manual — you ship a new version when you choose |
| Dependency on installed runtime | Yes — Windows App SDK runtime must be present | No — all dependencies are in your app package |
| NuGet package (C#/C++) | Microsoft.WindowsAppSDK.ML + Microsoft.WindowsAppSDK.Runtime |
Microsoft.Windows.AI.MachineLearning or Microsoft.WindowsAppSDK.ML |
| Best for | Apps that require a minimal download/install size; Apps shipping through the Microsoft Store | Strict version control |
Framework-dependent installation (recommended)
Framework-dependent apps rely on the Windows App SDK runtime being installed on the user's machine. See Deployment architecture for framework-dependent apps for details.
In your project, install or update the following NuGet packages:
- Microsoft.WindowsAppSDK.ML (this adds the Windows ML APIs)
- Microsoft.WindowsAppSDK.Runtime (this enables framework-dependent mode)
Note
Alternatively, install / update the main Microsoft.WindowsAppSDK NuGet package to version 1.8.1 or greater, which includes Windows ML and all other Windows App SDK APIs, and defaults to framework-dependent.
Also, in your .csproj file, ensure that WindowsAppSDKSelfContained is either unspecified (not present), or false, so that it uses framework-dependent deployment.
Finally, see Deployment architecture for framework-dependent apps to learn how to deploy the Windows App SDK runtime to your user's devices alongside your app.
Self-contained installation
Self-contained apps bundle all Windows ML binaries directly in the app. No external runtime dependency is required, but your app will be larger. This is the default when you reference Microsoft.Windows.AI.MachineLearning or Microsoft.WindowsAppSDK.ML without referencing the main Microsoft.WindowsAppSDK or Microsoft.WindowsAppSDK.Runtime package. See Deployment guide for self-contained apps for details.
In your project, install or update the following NuGet packages:
- For apps targeting Windows 10 Build 18362 or higher:
- Install Microsoft.Windows.AI.MachineLearning (this adds the Windows ML APIs and binaries, defaults to self-contained)
- Or, for apps targeting Windows 10 Build 17763 or higher:
- Install Microsoft.WindowsAppSDK.ML (this adds the Windows ML APIs and binaries, defaults to self-contained, and adds RegFree WinRT support for 17763)
- Do NOT install Microsoft.WindowsAppSDK.Runtime (this would enable framework-dependent mode... remove it if you currently have it installed)
- Do NOT install the main Microsoft.WindowsAppSDK NuGet package (this would enable framework-dependent mode... remove it if you currently have it installed)
- Feel free to install other Windows App SDK component packages like Microsoft.WindowsAppSDK.AI, as long as you don't install the Runtime or the main package
Note
If you must use the main Microsoft.WindowsAppSDK NuGet package, update it to version 1.8.1 or greater, which includes Windows ML and all other Windows App SDK APIs, and in your .csproj, set WindowsAppSDKSelfContained to true to enable self-contained mode.