Setting Up Your Development Environment for .NET MAUI

This guide will walk you through the essential steps to set up your machine for developing cross-platform applications with .NET MAUI (Multi-platform App UI).

Prerequisites

Before you begin, ensure you have the following installed:

Installing the .NET MAUI Workload

Once you have the .NET SDK installed, you need to install the .NET MAUI workload. This can be done using the .NET CLI.

For Windows:

Open your command prompt or PowerShell and run the following command:

dotnet workload install maui

For macOS:

Open your Terminal and run the following command:

dotnet workload install maui

This command downloads and installs all the necessary components for MAUI development, including build tools and SDKs for target platforms like Android, iOS, macOS, and Windows.

Configuring Visual Studio

Visual Studio 2022 (Windows)

  1. Launch Visual Studio Installer.
  2. Click Modify on your Visual Studio 2022 installation.
  3. In the Workloads tab, ensure that the .NET MAUI workload is selected. This workload includes the necessary components for Android and iOS development.
  4. If you intend to develop for iOS, you'll also need to ensure that the "Mobile development with .NET" workload is selected, which includes the Xamarin components required for MAUI's iOS support.
  5. Click Modify to install the selected components.

Visual Studio for Mac

  1. Launch Visual Studio for Mac.
  2. Go to Visual Studio > Check for Updates....
  3. In the Updates dialog, select the Updates Available tab.
  4. Expand the .NET MAUI section and ensure the .NET MAUI workload is selected for installation.
  5. Click Continue to install the workload.

Optional: Android SDK Setup

If you plan to develop for Android, you'll need the Android SDK. Visual Studio typically handles this installation for you when you select the .NET MAUI workload. However, you can also manage Android SDKs manually:

It's recommended to install at least one Android SDK platform and the corresponding build tools.

Optional: Xcode Setup (for iOS and macOS Development)

To develop and deploy .NET MAUI apps to iOS and macOS, you must have Xcode installed on a Mac. You can download Xcode from the Mac App Store.

You will need a Mac to build and debug iOS and macOS applications, even if you are primarily developing on Windows.

Creating Your First .NET MAUI App

With the setup complete, you're ready to create your first .NET MAUI application. You can do this directly from Visual Studio's project templates.

  1. Open Visual Studio.
  2. Select Create a new project.
  3. Search for ".NET MAUI" and select the ".NET MAUI App" template.
  4. Follow the prompts to name your project and choose a location.
  5. Select your target framework (e.g., .NET 7.0, .NET 8.0).
  6. Click Create.

Your new .NET MAUI project will be created, and you can now start building your cross-platform applications!