Yes, now it’s officially released !!! We can create Native Mobile and Desktop with C# & XAML and this is a cross-platform framework called .NET MAUI. MAUI stands for Multiple-Platform Application UI. We can develop applications for Android, iOS, Windows, and macOS from a single code base. This also means, that from a single project we can export applications to multiple platforms
- What is MAUI
- .NET MAUI is for
- Install Visual Studio 2022 Preview
- Create First .NET MAUI Application In Visual Studio 2022 Preview
- .NET MAUI App
- .NET MAUI Blazor
What is MAUI
MAUI means Multi-Platform App UI which is an open-source cross-platform framework. Using MAUI, we can develop and build native Android, iOS, macOS, Mac Catalyst, Tizen, and Windows applications from a single code base.
MAUI is an evolution of Xamarin.Forms, which extended from Mobile to Desktop applications. If you are already worked on Xamarin.Forms, you can easily relate to .NET MAUI.
.NET MAUI is for
- Developers who want to build cross-platform applications using C# and XAML from a single code base.
- Across platforms to share the same UI layouts and designs, which saves more time in design implementations.
- Across the platforms, to apply the same business logic, code, and testing.
Install Visual Studio 2022 Preview
At the time of writing this article, the .NET MAUI is available only in the Visual Studio 2022 Preview. Download Visual Studio 2022 Preview from here.
Once downloaded and installed, choose .NET Multi-platform App UI Development Workload from the list shown below.
After successful installation, it’s always better to Restart the machine, and then Launch Visual Studio 2022 Preview.
Create First .NET MAUI Application In Visual Studio 2022 Preview
- Launch Visual Studio 2022 Preview
- Choose to Create a new Project and Search for MAUI
- .NET MAUI has three categories, .NET MAUI App, .NET MAUI Blazor App, .NET MAUI Class Library
- We will look at more details of each category in our upcoming articles, For now, .NET MAUI App we can build applications for Andriod, iOS, Mac Catalyst, macOS, MAUI, Tizen, and Windows from a Single Code Base
- .NET MAUI Blazor App – These applications are built using Blazor and able to run in iOS, Andriod, Mac Catalyst, Tizen, and WinUI from a Single Code Base.
- .NET MAUI Class Library – These applications are built using .NET MAUI as Class Library and are able to run applications in Android, iOS, Mac Catalyst, macOS, Tizen, and Windows.
.NET MAUI App
Let’s create our first .NET MAUI App.
- Choose to .NET MAUI App from the Project Template options and click Next
- Save it in the location by providing the project name
- .NET MAUI App uses XAML and its similar to WPF
Project Folder Structure
The default project folder structure looks as like as shown below,
Debugging & Running the Sample App
- To run the application, we have multiple options
- We can run the application for the target devices like Windows Machine, Andriod Emulators, iOS Local Device, iOS Simulators, iOS Remote Devices
Run Application for Windows Machine
Run Application for Andriod Device
.NET MAUI Blazor
- .NET MAUI Blazor uses Blazor and using Blazor we can export applications for Multiple Platforms
- Choose .NET MAUI Blazor from the Project Template while creating a new project and save it.
Project Folder Structure of .NET MAUI Blazor Application
Below is what the default project folder structure looks like and if you are already familiar with Blazor, then this will be very easy for you.
Debugging and Running .NET MAUI Blazor Application
This project also has similar options to .NET MAUI App, to export the application to multiple platforms. Let’s Run the application for Multiple platforms
Run Application for Windows Machine
Run Application for Android Platform
In this article, we discussed how to Create .NET MAUI Application and debug it on multiple platforms. In this article, We discussed debugging for Windows and Android devices, we have not covered the iOS and Mac devices, which we will cover it in our upcoming articles. Please feel free to share your feedback in the comment section.