Get Started with .NET MAUI

Welcome to the world of .NET Multi-platform App UI (.NET MAUI)! This guide will help you set up your development environment and build your first cross-platform application.

What is .NET MAUI?

.NET MAUI is an open-source, cross-platform framework for creating native mobile and desktop applications with C# and XAML. It's the evolution of Xamarin.Forms, offering a modern, unified development experience for building apps that run on Windows, macOS, Android, and iOS from a single C# codebase.

Prerequisites

Before you begin, ensure you have the following installed:

For detailed installation instructions, please refer to the official setup guide.

Creating Your First .NET MAUI App

Let's create a simple "Hello, World!" application.

Using the .NET CLI

Open your terminal or command prompt and run the following commands:

dotnet new maui -n MyMauiApp

Navigate into your new project directory:

cd MyMauiApp

And run your app:

dotnet build -t:Run -f net6.0-android
dotnet build -t:Run -f net6.0-ios
dotnet build -t:Run -f net6.0-maccatalyst
dotnet build -t:Run -f net6.0-windows

Note: The exact command to run may vary slightly depending on your target platform and SDK version.

Using Visual Studio

  1. Open Visual Studio 2022.
  2. Select "Create a new project".
  3. Search for ".NET MAUI App" and select the template.
  4. Click "Next".
  5. Enter your project name (e.g., "MyMauiApp") and location, then click "Create".
  6. Once the project is created, select your desired target platform from the toolbar dropdown (e.g., Windows Machine, Android Emulator) and click the Run button.

Understanding the Project Structure

Your .NET MAUI project has a well-defined structure:

Next Steps

Now that you have your first app running, you can explore further:

Learn XAML

Discover how to build user interfaces with XAML, the declarative UI markup language for .NET MAUI.

Learn XAML

Explore Controls

Dive into the rich set of built-in UI controls available in .NET MAUI.

View Controls

Data Binding

Understand how to bind data to your UI elements for dynamic updates.

Data Binding Guide

Platform Specifics

Learn how to access native platform APIs when needed.

Platform APIs

Helpful Resources

Explore More Tutorials