Build your first app

In this tutorial, you'll learn how to create and run your first .NET Multi-platform App UI (.NET MAUI) app.

Important

.NET Multi-platform App UI (.NET MAUI) is currently in preview. This content relates to a pre-release product that may be substantially modified before it's released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Visual Studio for Mac support will arrive in a future release.

Prerequisites

  • The latest preview of Visual Studio 2022 17.1, with the required workload. For more information, see Installation.

Get started with Visual Studio 2022 17.1 (Preview)

In this tutorial, you'll create your first .NET MAUI app in Visual Studio 2022, and run it on an Android emulator:

  1. Launch Visual Studio 2022 17.1 (Preview), and in the start window click Create a new project to create a new project:

    New solution.

  2. In the Create a new project window, select MAUI in the Project type drop-down, select the .NET MAUI App (Preview) template, and click the Next button:

    Choose a template.

  3. In the Configure your new project window, name your project, choose a suitable location for it, and click the Create button:

    Configure the project.

  4. Wait for the project to be created, and its dependencies to be restored:

    Restored dependencies.

  5. In the Android SDK License Acceptance window, press the Accept button:

    Android SDK License Acceptance window.

  6. In the User Account Control dialog, press the Yes button:

    User Account Control dialog.

    Wait for Visual Studio to download the Android SDK and Android Emulator.

  7. In the Visual Studio toolbar, press the Android Emulator button to build the app:

    Android emulator button.

  8. In the User Account Control dialog, press the Yes button:

    User Account Control dialog.

  9. In the New Device window, press the Create button:

    New Android Device window.

  10. In the License Acceptance window, press the Accept button:

    License Acceptance window.

    Wait for Visual Studio to download, unzip, and create an Android emulator.

  11. Close the Android Device Manager window:

    Android Device Manager window.

  12. In the Visual Studio toolbar, press the Pixel 5 - API 30 (Android 11.0 - API 30) button to build and run the app:

    Pixel 5 API 30 emulator button.

    Visual Studio will start the Android emulator, build the app, and deploy the app to the emulator.

  13. In the running app in the Android emulator, press the CLICK ME button several times and observe that the count of the number of button clicks is incremented.

    App running in the Android emulator.