MSDN Documentation

Introduction to .NET MAUI Deployment

.NET MAUI (Multi-platform App UI) enables you to build native applications for Android, iOS, macOS, and Windows from a single, shared C# codebase. This document provides a comprehensive guide to deploying your .NET MAUI applications across various target platforms.

Note: Deployment procedures can vary significantly based on the target platform, your development environment, and distribution methods.

Android Deployment

Deploying your .NET MAUI app to Android involves creating an APK (Android Package) or an App Bundle for distribution.

Prerequisites

Steps

  1. Configure Project Properties: In Visual Studio, right-click on your Android project and select "Properties". Configure settings like package name, version, and target frameworks.
  2. Build for Release: Select "Release" configuration and "Android" as the target platform.
  3. Create APK or App Bundle:
    • For an APK: Navigate to Build > Publish Android App in Visual Studio. Follow the wizard to configure signing keys and distribution channels (e.g., Google Play Store).
    • For an App Bundle: Use the dotnet publish -f net6.0-android -c Release command in the terminal, or use Visual Studio's publish options. App Bundles are recommended for Google Play.
  4. Signing: Ensure your application is signed with a release key to be deployable to app stores.

You can also deploy to an emulator or device directly from Visual Studio by selecting the appropriate target.

Refer to the official Android Deployment Guide for detailed instructions.

Android

Build and deploy your MAUI application to Android devices and the Google Play Store.

iOS Deployment

Deploying .NET MAUI applications to iOS requires a macOS machine with Xcode installed. You can deploy to simulators or physical devices.

Prerequisites

Steps

  1. Configure Project Properties: In Visual Studio for Mac or Visual Studio (connected to a Mac), right-click on the iOS project and configure settings like bundle identifier and deployment target.
  2. Build for Release: Select "Release" configuration and "iOS" as the target platform.
  3. Archive and Distribute:
    • In Visual Studio for Mac, go to Build > Archive For Publishing.
    • This will create an archive that can be deployed to test devices or submitted to the App Store via Xcode's Organizer.
  4. Signing: Ensure your app is signed with the correct provisioning profiles and certificates.

For detailed information, consult the iOS Deployment Guide.

iOS

Deploy your MAUI application to iPhones and iPads, targeting the Apple App Store.

Windows Deployment

Deploying .NET MAUI applications to Windows can be done using MSIX packages or direct executables.

Prerequisites

Steps

  1. Configure Project Properties: In your Windows project properties, set up package information.
  2. Build for Release: Select "Release" configuration and "Windows" (or "WinUI") as the target platform.
  3. Create MSIX Package:
    • Right-click the Windows project and select Publish > Create App Packages.
    • Choose "Sideloading" for manual installation or "Microsoft Store" for distribution via the Microsoft Store.
    • Follow the wizard to generate the MSIX package.
  4. Direct Executable: For simpler deployment, you can publish directly as an executable. Use the command: dotnet publish -f net6.0-windows10.0.19041 -c Release -p:WindowsPackageType=None

For more details, see the Windows Deployment Guide.

Windows

Package and deploy your .NET MAUI application for Windows 10 and Windows 11.

macOS Deployment

Deploying .NET MAUI apps to macOS involves creating a `.app` bundle, typically for distribution via the Mac App Store or direct download.

Prerequisites

Steps

  1. Configure Project Properties: Set up the macOS project's bundle identifier and other relevant settings.
  2. Build for Release: Select "Release" configuration and "Mac Catalyst" (for cross-platform) or "macOS" as the target.
  3. Create .app Bundle:
    • Use the command dotnet publish -f net6.0-maccatalyst -c Release or dotnet publish -f net6.0-macos -c Release.
    • Visual Studio for Mac provides archiving and distribution options similar to iOS.
  4. Code Signing: Essential for macOS deployment, especially for App Store submission.

Learn more in the macOS Deployment Guide.

macOS

Package your .NET MAUI application for macOS, including distribution through the Mac App Store.

Linux Deployment

.NET MAUI currently has experimental support for Linux. Deployment typically involves building a self-contained application that can be run on Linux environments.

Prerequisites

Steps

  1. Build for Release: Use the .NET CLI: dotnet publish -f net6.0-linux -c Release.
  2. Runtime Identifiers (RIDs): Specify the correct RID for your target Linux distribution (e.g., -r linux-x64).
  3. Dependencies: Ensure all necessary runtime dependencies are available on the target Linux machine.

Note: Linux support is still evolving. Check the latest documentation for current capabilities.

See the Linux Deployment Guidance for updates.

Linux

Experimental support for deploying .NET MAUI applications to Linux distributions.

Web Deployment

While .NET MAUI is primarily for native applications, Blazor Hybrid can be used to embed Blazor Web components within native apps. For full web deployment, consider using Blazor WebAssembly or Blazor Server.

This section focuses on deploying the native MAUI applications.

Web

This section covers native app deployment. For web-specific technologies, refer to Blazor documentation.

Packaging Options

Beyond platform-specific deployment, .NET MAUI offers flexible packaging options:

Next Steps

After successfully deploying your .NET MAUI application, consider the following:

Important: Always refer to the official documentation for the most up-to-date information and specific commands for each platform.