top of page

(Very) quickstart .NET Maui with Visual Studio Code

  • julienmesser
  • Mar 24, 2024
  • 1 min read

This tutorial describes how to install the .NET Maui and create your first app in only a few minutes. Maui means "Multi-platform App UI", it is a framework from Microsoft to develop user interfaces which can run in any platform.


Installation

  • You will need .NET SDK. In my case I installed .NET 8.0 SDK

  • Please install Visual Studio Code

  • Then install maui workload using powershell:

dotnet workload install maui

After a few minutes the installation is finished:

...Installing Microsoft.Maui.Graphics.Win2D.WinUI.Desktop.Msi.x64 ....Done
Successfully installed workload(s) maui.
  • Finally install the Visual Studio Code extension "MAUI" (the extensions "C#" and "C# Dev Kit also get installed automatically)


Create a demo-app

  • In the Visual Studio Code command palette (F1), run ".NET New Project"

  • Choose ".NET MAUI App":


  • After having selected a location, an example project will be initialized


Execute and debug your program

  • Open the project file (MauiApp1.csproj) and execute "Run and Debug" from the tab having the same name on the left side.

  • The app starts:


Debug your program

Set a breakpoint (example: in the method "OnCounterClick") and start the program again. After executing the app again, you can debug step-by-step:


Problems

After trying to debug directly from the class file, I got the following error:

C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.85\tools\Xamarin.Android.Tooling.targets(70,5): error XA5300: The Android SDK directory could not be found. Install the Android SDK by following the instructions at: https://aka.ms/dotnet-android-install-sdk [C:\ws\MauiApp1\MauiApp1.csproj::TargetFramework=net8.0-android]

 
 
 

Comentários


JulienGraphic.jpeg

Hello it's me Julien

Passionate about many fields such as IT, I created this blog. I hope you enjoy reading me.

    Subscribe if you want to follow my publications.

    Inscription

    Merci pour votre inscription!

    bottom of page