.NET MAUI
Electron · Tauri · Qt · Flutter · React Native · Capacitor and Ionic · .NET MAUI
.NET MAUI applications use the NuGet package on every MAUI platform. Its runtime dependencies contain native libraries for desktop identifiers, iOS, the iOS simulator and Android. The .NET installation page describes the API.
Requirements
Section titled “Requirements”The package’s iOS and Android assemblies are net10.0-ios and net10.0-android. The application therefore needs .NET 10 or newer with the MAUI workload. Install the workload with dotnet workload install maui. Android builds also need the Android SDK and a JDK.
| Application platform | Minimum version |
|---|---|
| macOS desktop, through Mac Catalyst | 12 |
| Windows desktop | No separate minimum |
| iOS mobile | 15 |
| Android mobile | 13 (API level 33) |
Build each mobile application on the host that its platform’s toolchain requires.
What ships
Section titled “What ships”The C# (.NET) column of the compatibility matrix, packaged for .NET MAUI. Each release runs the quickstart on the platforms in this table. Other platforms have no verification for this integration.
| Platform | Targets | Package |
|---|---|---|
| macOS | macos-arm64, macos-x86_64 | potluckdb |
| Windows | windows-x86_64, windows-arm64 | potluckdb |
| iOS and iPadOS | apple-mobile-device-arm64, apple-mobile-simulator-arm64, apple-mobile-simulator-x86_64 | potluckdb |
| Android | android-arm64-v8a, android-x86_64 | potluckdb |
Install
Section titled “Install”Create the Notes application.
dotnet new maui -n Notescd Notesdotnet add package potluckdbIn Notes.csproj, change the Android SupportedOSPlatformVersion from 21.0 to 33.0. Its Condition ends with == 'android'.
Use one package reference for every target framework in the project. Mac Catalyst and Windows select the runtime package by target identifier. iOS links the runtime statically into the application. Android uses the AAR inside the runtime package.
Quickstart
Section titled “Quickstart”Replace the template’s MainPage.xaml and MainPage.xaml.cs with the files below. The page opens the database under the application data directory, inserts a note and lists the table. dotnet build -t:Run with the target framework of the platform builds and starts the application.
The application logs quickstart: ok once the database is open. On Android, the line is in the device log with the tag DOTNET. On iOS, it is in the simulator’s log.
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Notes.MainPage" />// potluckdb in a .NET MAUI application: one database under the application data directory,// on macOS, Windows, iOS and Android from the same file.
using System;using System.IO;using System.Linq;using Microsoft.Maui.Controls;using Microsoft.Maui.Storage;using PotluckDB;
namespace Notes;
public partial class MainPage : ContentPage{ private readonly Remote remote; private readonly Database db;
public MainPage() { InitializeComponent(); var data = FileSystem.AppDataDirectory; remote = Remote.FromDirectory(Path.Combine(data, "remote")); // a bucket replaces this in production; see the .NET installation page db = Database.Open(Path.Combine(data, "notes.potluckdb"), remote); db.Execute("CREATE TABLE IF NOT EXISTS note(id INTEGER PRIMARY KEY, body TEXT NOT NULL)"); db.Execute("INSERT INTO note(body) VALUES(?)", Bindings.Positional("buy milk")); var rows = db.Query("SELECT id, body FROM note ORDER BY id"); Content = new ListView { ItemsSource = rows.Select(row => $"{row["id"]}: {row["body"]}").ToList() }; Console.WriteLine("quickstart: ok"); }
protected override void OnHandlerChanging(HandlerChangingEventArgs args) { base.OnHandlerChanging(args); if (args.NewHandler != null) return; db.Dispose(); remote.Dispose(); }}Verified by the release
Section titled “Verified by the release”Each release verifies persisted notes after restarting this application on Mac Catalyst, Windows, the iOS simulator, and the Android emulator. The iOS device and arm64-v8a Android libraries compile but do not run in these checks.