Special Offer: My C#/.NET Bootcamp Course is out now. Get 10% OFF using the code FRIENDS10.

I wanted to look at .NET MAUI, but I had a hard time making it work on my machine. If you have any problem getting started with .NET MAUI, maybe this will help you get .NET MAUI running on Windows.

If you are new to .NET MAUI and want a short and concise overview and want to learn about the difference between .NET MAUI and Xamarin Forms, check out this Introduction to .NET MAUI video.

The Current State of the Tools

First of all, we must understand that .NET MAUI and Visual Studio 2022 are currently in preview, and .NET 6 is in release candidate state at the time of this writing. 

The experience we now have as early adopters won’t be the same when those products hit general availability (GA) a few months in the future.

Official Getting Started Guide

It’s important to use the official .NET MAUI Getting Started guide to set up your system. Don’t try to do it on your own. I tried, and I failed.

  1. Make sure you have the latest Visual Studio 2022 preview installed.
    Hint: You can run multiple Visual Studio versions side-by-side. Learn more about Visual Studio 2022 and its new features in this video.
  2. Make sure you have the latest .NET 6 preview/release candidate version installed. If available at the time of reading this, install the released .NET 6 SDK.
    Hint: You can check your installed .NET SDKs using the following command: dotnet –list-sdks in your favorite terminal.
  3. Install and execute maui-check. Maui-check is a utility that verifies your installation. If you lack anything, maui-check will try to reconfigure your system and install the missing pieces.

Thanks to Gerald Versluis, who mentioned it to me.

Installing Visual Studio 2022 Preview

Ensure that you select all the workloads you see in the official .NET MAUI Visual Studio 2022 installation guide. 

I didn’t install the .NET Desktop development workloads, the desktop development with C++, and the Universal Windows Platform development workloads. I’m not sure what was missing, but one of them caused an issue where you could not deploy the mobile to your Android emulator. 

In short: Make sure to install precisely the workloads described in the installation guide.

Additionally, you need to install the Single-project MSIX Packaging Tools Visual Studio extension to target the Windows UI Library (WinUI) 3. 

Again, don’t skip this step, even if you only want to use Android as the target for your mobile application.

Error: Java SDK 11.0 or above is required when using .NET 6

When I tried to build a project created by the default .NET MAUI template in Visual Studio 2022 preview, I received this error:

Java SDK 11.0 or above is required when using .NET 6

If you run into this error, make sure to run maui-check and/or install the latest Microsoft OpenJDK.

HAXM Installer Not Found

You can either run your Android emulator using Hyper-V hardware acceleration or HAXM hardware acceleration. Check this installation guide and make sure that you have the proper installation for your system.

In my case, I didn’t want to enable Hyper-V as a Windows feature and decided to use HAXM. As described in the article, you can download the Intel Hardware Accelerated Execution Manager from GitHub and install it.

Visual Studio Skips App Deployment

If you can build your mobile app and launch your emulator, but your app is not deployed to the emulator, check the Configuration Manager settings. You can find it in the Build menu.

You might also receive the following error message in a message box:

The project needs to be deployed before we can debug.
Please enable Deploy in the Configuration Manager.

In my case, the Deploy checkbox in the last column was unchecked, and therefore the app was not deployed to the emulator.

Configuration Manager

If You Tried It All and It Still Doesn’t Work

If you closely followed the official guide and tried everything written in this article, reboot your system and try again. Seriously, sometimes it helps. 

I had a strange issue that prevented Visual Studio from finding the Android SDK when it was available in the path it was looking for it. After a restart, everything worked as expected.

How It Should Look

I tried to write down everything I came across setting up my machine for .NET MAUI development. This image shows how the app from the default app template should look in the Android emulator.

Running .NET MAUI App on Android Emulator

Congratulations and good luck exploring .NET MAUI.

 

Claudio Bernasconi

I'm an enthusiastic Software Engineer with a passion for teaching .NET development on YouTube, writing articles about my journey on my blog, and making people smile.