.NET MAUI Tutorial - Build your first multi-platform app in C#

Create your app

Create a new .NET MAUI app:

  1. Open Visual Studio 2022.
  2. Select the Create a new project button.
  3. In the Create a new project window, type MAUI App in the search bar. Select the .NET MAUI App template, and then click the Next button.

    Visual Studio new project dialog with .NET MAUI App selected

  4. In the Configure your new project window, enter MyFirstMauiApp as the project name and click the Next button.

    Visual Studio configure your new project dialog with MyFirstMauiApp as the project name

  5. In the Additional information window, select .NET 9.0 in the Framework drop-down if not already selected and click the Create button.

    Visual Studio additional information dialog showing .NET 8.0 in the Framework drop-down.

    Visual Studio creates the new project. If you get a Windows Security Alert warning you about the firewall blocking some features, select the Allow access button.

Wait for NuGet packages restore process

NuGet is a package manager that will bring in the dependencies of your new app.

The package restore process will start automatically. Wait until the Restored or Ready message appears in the status bar at the bottom left of the screen.

Visual Studio status bar showing the Ready message.

  1. Open the command palette in VS Code by pressing CMD+SHIFT+P.
  2. Type .NET: to see the commands you can run with C# Dev Kit!
  3. Find and select .NET: New Project to create a new .NET project.
  4. Select .NET MAUI App.
  5. Choose the folder location you'd like to save your project.
  6. Name the project MyFirstMauiApp in the command palette when prompted.

If you have a Visual Studio Subscription, sign into your account. If you don't see a prompt pop up, click on the C# icon in VS Code's Status Bar towards the bottom right of your window.

Sign in with VS Subscription

In VS Code's Side Bar, make sure the Explorer is open. Here you should see a folder and the Solution Explorer. If you've opened a new instance of VS Code, the Solution Explorer may be near the bottom of the sidebar.

VS Code's Solution Explorer for MAUI App'

Under the Solution Explorer, select MainPage.xaml. This file contains the markup that describes the structure and layout of the user interface elements in your MAUI application.

VS Code's Solution Explorer for MAUI App'

Continue