.NET MAUI

Your Gateway to Cross-Platform Development

What is .NET MAUI?

.NET MAUI (Multi-platform App UI) is an open-source, cross-platform framework for creating native mobile and desktop applications with C# and XAML from a single shared codebase. It builds on the .NET platform and enables developers to create apps for Android, iOS, macOS, and Windows.

With .NET MAUI, you can leverage your existing C# skills to build beautiful, high-performance applications that reach a broad audience across multiple platforms.

Prerequisites

Before you begin, ensure you have the following installed:

  • .NET 6 or later: The .NET MAUI framework is built on .NET 6. You can download the latest SDK from the official .NET website.
  • Visual Studio:
    • Windows: Visual Studio 2022 version 17.0 or later.
    • macOS: Visual Studio for Mac.
  • MAUI Workload: When installing Visual Studio, make sure to select the ".NET Multi-platform App UI development" workload.
  • Optional: Xcode for iOS and macOS development, Android SDK for Android development.

Setting Up Your Development Environment

Follow these steps to set up your environment for .NET MAUI development:

1

Install .NET SDK

Download and install the latest .NET SDK from dotnet.microsoft.com/download.

2

Install Visual Studio

If you don't have Visual Studio installed, download it from visualstudio.microsoft.com/downloads/.

During the installation, select the ".NET Multi-platform App UI development" workload.

3

Verify Installation

Open a terminal or command prompt and run the following command to verify your .NET MAUI installation:

dotnet workload list

You should see entries related to MAUI workloads, such as maui.

Creating Your First .NET MAUI App

Let's create a simple "Hello, World!" app:

1

Create a New Project

Open your terminal or command prompt and navigate to the directory where you want to create your project. Then, run the following command:

dotnet new maui -n MyMauiApp

This command creates a new .NET MAUI project named MyMauiApp.

2

Open in Visual Studio

Navigate into the newly created project directory:

cd MyMauiApp

Then, open the solution file (MyMauiApp.sln) in Visual Studio.

3

Run the Application

In Visual Studio, select your desired target platform (e.g., Windows Machine, Android Emulator, iOS Simulator) from the dropdown menu and click the "Run" button (the green play icon).

You should see your basic .NET MAUI application running!

What's Next?

Congratulations on creating your first .NET MAUI app! Here are some resources to help you continue your journey: