
Step by Step Setup Guide for .NET MAUI with Visual Studio Code
MAUI
1 Articles
Table of Contents
What we gonna do?
Setting up MAUI development environment in Windows Machine is easy and straight forward. All you need to do is to install Visual Studio 2022 and select appropriate workload for MAUI development. But its not that easy in MacOS.
In this post, I'll teach you how to setup MAUI development environment especially in Mac OS using Visual Studio Code.
Why we gonna do?
I'm mostly using Mac OS for the last 5 years as of writing this. Mac OS has the only option of doing it via Visual Studio Code and its not as straight forward as Windows. Installing a different version of even one dependency will end up in errors. And this setup will alteast take 30 minutes to 1 hour to complete.
I'm doing this for a second time and still I find it not straight forward and easy. Hence documenting steps for future reference.
How we gonna do?
Let's start the setup process.
- Download and install latest .NET SDK from download .net sdk. I'm using .NET 9 as of writing this.
-
Run the command dotnet workload list. If you don't see like What you have in below image, then you need
to install the workload using dotnet workload install maui.
-
You can run dotnet workload search to see the installed workloads.
-
Now install Visual Studio Code and install .NET MAUI Extension
inside Visual Studio Code. This will automatically install C# and C# Dev Kit extensions as well.
-
Now create a new .NET MAUI project using dotnet new maui command or
open and existing MAUI project in Visual Studio Code. Visual Code Editor will start
analysis and it will show the below logs in the output window.
-
Now go to
.NET MAUI Release Versions. I got this link from the
official docs from
here.
You can find the compatibility matrix as shown below. You need to install the respective dependencies
based on the version of .NET MAUI you are using. In my case, I'm using
.NET MAUI 9 latest.
So I need to install JDK 17, Android 35 and XCode 16.1.
-
The easiest way to install XCode is by doing it from Mac app store only If the version shown in
release compatibility matches with version shown in app store else you need to download and install from
xcodereleases.com. If you are
downloading And Installing then make sure to move to application folder before executing it.
Then run the following in terminal xcode-select —install.
-
Now open xcode and install ios and other necessary components and as this will help to bring
respective simulator.
-
Now finally make sure command line tools is set to installed xcode version. Thats All for ios and macos.
- Now for android, first download and install matching JDK version from Open JDK download. In my case its JDK 17.
-
Now download and install Android SDK from
Android Studio. This will install
Android SDK and Android Studio.
-
Now when you go back to Visual Studio Code, you will see the below logs in the output window which shows
xcode is successfully installed.
-
If you scroll above in output window you will see missing android dependencies like
build tools and command line tools.
-
Now open Android Studio and go to Android Studio -> More Options -> SDK Manager -> SDK Tools to
install missing tools. Tick the show package details checkbox to see the version to install. You need
to install the exact ersions shown in above output window otherwise you will end up in errors.
select appropriate version and click apply.
-
Now go back to Visual Studio Code and press cmd+shift+p and type
>.netmaui and select configure android and click on
refresh android environment.
-
Now you will see the below logs in the output window that shows android is successfully installed.
-
All you need to do now is to run xcode as this is needed to bring simulator and
set debug target in Visual Studio Code to ios and select the device
and run the app.
-
Similarly for Android, open Android Studio -> More Actions -> Virtual Device Manager and
create a new device or run the existing device and
set debug target in Visual Studio Code to android and select the device and run the app.
Summary
In this post, I have shown you how to setup MAUI development environment in Mac OS using Visual Studio Code. This setup is not as straight forward as Windows and it will take alteast 30 minutes to 1 hour to complete. Many thanks for checking this and learning with me.