.NET MAUI – Windows

Contents

Overview

.NET Multi‑Platform App UI (MAUI) enables you to build native Windows desktop applications using a single shared codebase. This guide walks you through setting up your development environment, creating a Windows‑targeted MAUI app, and leveraging Windows‑specific features such as WinUI 3, app notifications, and the Windows Store.

Prerequisites

Create a MAUI Project

Open a PowerShell prompt and run:

dotnet new maui -n MyMauiWindowsApp
cd MyMauiWindowsApp
dotnet build

The Platforms\Windows folder contains the Windows project files.

Run on Windows

From Visual Studio, select Windows Machine and press F5. Alternatively, use the CLI:

dotnet run -f net8.0-windows10.0.19041.0

The app launches with a default WinUI 3 window.

Windows‑specific APIs

Use the Microsoft.UI.Xaml namespace for WinUI controls or call Windows Runtime APIs through Windows.Win32. Example: displaying a toast notification.

using Windows.UI.Notifications;
using Windows.Data.Xml.Dom;

public static void ShowToast(string title, string message)
{
    var toastXml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText02);
    var stringElements = toastXml.GetElementsByTagName("text");
    stringElements[0].AppendChild(toastXml.CreateTextNode(title));
    stringElements[1].AppendChild(toastXml.CreateTextNode(message));
    var toast = new ToastNotification(toastXml);
    ToastNotificationManager.CreateToastNotifier().Show(toast);
}

Remember to add the AppxManifest.xml capability ToastCapable set to true.

Packaging & Deployment

Package your app as an MSIX installer:

dotnet publish -f net8.0-windows10.0.19041.0 -c Release /p:ApplicationPackages=true

The output is located in bin\Release\net8.0-windows10.0.19041.0\win10-x64\AppPackages. Use the generated .msixbundle to distribute via Microsoft Store or side‑load.

Troubleshooting