.Net MAUI is a cross-platform framework for creating native mobile and desktop app with c# and Xaml. In my previous article, we did warn welcome to Dotnet MAUI and shared information about the History of Xamarin.

MAUI as everybody already knows is a name for a new upgrade solution as a Multi-platform APP UI framework for building native cross-platform apps with .Net for android, iOS, macOS, and Windows. I am going to show how to create, build and debug the First MAUI application using Visual Studio 2022.

NET MAUI is the .NET Multi-platform App UI, a framework for

MAUI and other third-party framework teams started working on support for upgrading the app and old NuGet package to MAUI. MAUI will also provide you support for building the apps in different modern patterns and frameworks MVVM, MVU and RxUI.


Microsoft provided 3 fantastic IDE Tools to create and develop apps with .NET MAUI and the happy news is MAUI is an open source.
  1. Visual Studio
  2. Visual Studio for Mac
  3. Visual Studio Code

Visual Studio 2022

On Windows or Mac machines you can use Visual Studio Code or Visual Studio/ VS for Mac for development. You will need the visual studio 2022 17.1.0 preview version. Microsoft released Visual studio 2022 version 17.0 in Nov month, but MUAI is still in preview so you can start to install visual studio 2022 17.1.0 preview version to create your first MUAI application.

Build your first .NET MAUI app

After installation success, Open the Visual Studio IDE

What .NET MAUI Means for Xamarin Developers

In this sample demo application, I am  going to show Android, iOS, and Windows app using MAUI, so Get started with “Create New Project”

What is .NET MAUI, and How Does it Differ from Xamarin?

On the new Project template, select project type as an” MAUI” and you will all the MAUI preview template, if you are not finding the MAUI template means, you have not installed the latest preview version so make sure you have installed the latest preview version 17.1 ++.

Microsoft Replaces Xamarin Toolkits with New .NET MAUI

In the Configure your new project window, name your project, choose your project location where you need to save, and click the Create button

The future of Xamarin: .NET MAUI

MAUI Solutions Structure

After clicking on Create, MAUI solutions default template loaded with all the related MAUI NuGet packages. There is a single project with different platform folders and resources.

Creating first .Net MAUI project


The main page, whichever design, will support all other platforms as well, and also Main Page XAML build action modified in MAUI app.

Main Page.Xaml build action modified with MAUIXAML, make sure Xaml Build action is correct.

Right click on the XAML page >>Properties>>BuildAction of XAML Page to MauiXaml.

Creating new .NET 6 MAUI project

.NET Generic Host

The Worker Service templates, create a .NET Generic Host, HostBuilder. The Generic Host can be used with other types of .NET applications, such as Console apps.

Maui Program class enables apps to be initialized from a single location, and provides the ability to configure fonts, services, and third-party libraries.

iOS, Android, windows, and all the platform entry point calls a CreateMauiApp method of the static MauiProgram class that creates and returns a MauiApp, while lunch the application

.NET MAUI: How MAUI Will it impact on Xamarin Native applications?

Application Class

The App class derives from the Application class

Workload Repair failed: `dotnet workload repair - MAUI


The resources are a good improvement in MAUI. The AppIcon, image and font folder will be available under the MAUI project and it is just a single SVG, Looks like Maui will just automatically take care of generating all the different icon sizes for different devices.

How do I determine where the error is when I check MAUI compatibility with maui-check?How do I determine where the error is when I check MAUI compatibility with maui-check?

Run IOS App

Building MAUI iOS applications requires access to Apple's build tools, which only run on a Mac. Because of this, Visual Studio 2022 must connect to a network-accessible Mac to build iOS applications.

You must install the Xcode 13.1++ version on the Mac machine before connecting Visual Studio 2022 to the Windows machine.

Windows Configuration 

  1. Connect same wifi network
  2. Download and install Visual Studio 2022 with MAUI

Mac Configuration

  1. Connect same wifi network
  2. Install Xcode 13.1 ++
  3. On Network preference > switch on Remote login
Pair to Mac machine from windows

Pair to Mac for Xamarin.iOS Development


Program class file is the main entry file on IOS app and executes the main method of the application, here you can define your custom app delegate file and other configuration files


Each platform will call MauiProgram static class for initialize. On iOS will call as below

You can select iOS simulator and device and click Run icon for executing the application

The out as like below

Run Android App

The android application, MainApplication.cs will execute first, it will call the MauiProgram static class initially as like below
You can select android simulator or device as below, press F5 to run the application

The output like below

Run Windows App

The Windows application executes  App.xaml.cs file first, it will call the MauiProgram static class initially as like below

Select the device and run the Application

MAUI Windows device

Demo Video

I have shared a recorded demo video with two versions, English and Tamil. It will help you to understand more about creating, building, and debuging the First MAUI application.

English Demo Video

Tamil Demo Video 

Hope this article is very useful for you, If you have any questions/ feedback/ issues, please write in the comment box

Xamarin was released 10 years before, it has helped many developers to develop mobile apps with multi-platform with native feel but now it’s time to say goodbye to Xamarin and happily welcome .NET MAUI (Multi-platform App UI).

Let’s go back a bit in time first, the name Xamarin comes from the name of the Tamarin monkey, replacing the leading T with an X.

On May 16, 2011, Miguel de Icaza announced on his blog that Mono would be developed and supported by Xamarin.

In 2016, Xamarin has been acquired by Microsoft, after that Xamarin is open source and removed payment options. This helped the adoption of Xamarin. Microsoft then integrated Xamarin into Visual Studio. All the mobile development company started using visual studio in both Windows and Mac, it is great improvement after Microsoft acquires Xamarin.

Announcing .NET Multi-platform App UI Preview 3

Every developer and company should be very clear, Microsoft isn’t throwing away Xamarin. Mono won’t be going anywhere yet. .NET MAUI is the next generation of Xamarin Forms, intended to allow developers to build an app once in a single Visual Studio project with a single codebase, targeting any supported device. The aim is to deliver a simplified project structure. Rather than a single solution with separate projects for each platform you’re targeting, with MAUI a single project will contain the resources needed to target specific platforms.

David blog helped me to understand more about setup. In this article, I will explain how to create the first hello world app using the MAUI application.

Visual Studio 2019 Preview

Visual studio 2019 early access preview version you can download from Microsoft website . This release is not "go-live" so not recommended to use on production computers or for creating production code.

Introducing .NET Multi-platform App UI

Verify MAUI SDK Installation

Previously was install all the required SDK is manual, Now, Jonathan Dick has put together a useful dotnet tool that evaluates your system and gathers as many of the required pieces as it can. To get started, install maui-check globally from the command line.

Open Run CMD as an Administrator mode and install MAUI Check tool using the below line

dotnet tool install -g Redth.Net.Maui.Check

5 Advantages of .NET MAUI Over Xamarin

After MAUI check tool install, will start to execute the below the line of code to verify the SDK installation


Introducing .NET Multi-platform App UI (MAUI)

You need to install the Preview 2 version of the dotNet 6 SDK, as well as the Preview 2 Android, iOS, and Mac Catalyst workloads so if you are getting any error alert saying SDK is missing, keep give input as “Yes” for install the missing SDK and wait for the “Congratulations, everything looks great!” message, that means, you are ready to start the new MAUI application.

Goodbye Xamarin.Forms, Hello .NET MAUI!

Create a new MAUI Mobile application

Visual Studio 2019 Preview version default available MAUI project template and select Create a new project, otherwise, you can download the default project sample available in the Git MAUI official repository.

MAUI in .NET 6: Xamarin.Forms Does Desktop, but Not Linux or VS Code

Search for "MAUI" or choose Mobile from the Project type menu. Select the .Net Maui Mobile application

Understanding .NET MAUI and the future of Xamarin

Choose a project name – the example uses "HelloMaui" and click on Create

Understanding .NET MAUI and the future of Xamarin

Once you click on create button automatically solutions will generate. Before building the solutions, Let quickly understand all the folders and files.

MAUI Application Startup

Multi-targeted .NET MAUI Single Project for iOS and Android. .NET MAUI starts every application using Microsoft.Extensions HostBuilder.

What Is .NET MAUI?

Each platform has a different starting point, and the consistent point of entry for your application is Startup.cs will allow the following. It includes a Configure method to pipe service registration, handler registration
public class Startup : IStartup

public void Configure(IAppHostBuilder appBuilder)
appBuilder .UseMauiApp<App>();


Application customization processes, this is where you can do such things as register fonts and register compatibility for Xamarin.Forms renderers or your own custom renderers, By default, if you don't want to customize anything special, ignore this




.ConfigureFonts(fonts => {

fonts.AddFont("ionicons.ttf", "IonIcons");


MAUI Application Life cycle

.Net MAUI Application preview 3 Support to manage the life cycle of the application. Life Cycle API included in Startup.cs file and will write platform-specific.

public void Configure(IAppHostBuilder appBuilder)



.ConfigureLifecycleEvents(lifecycle => {


lifecycle.AddAndroid(d => {

d.OnBackPressed(activity => {

System.Diagnostics.Debug.WriteLine("Back button pressed!");






MAUI App.Xaml

In App.Xaml.cs project inherited by Microsoft.Maui.Controls.Application and make sure MAUI namespace added specify common Image directory for all the platform

using Microsoft.Maui;
using Microsoft.Maui.Controls.PlatformConfiguration.WindowsSpecific;

namespace HelloMaui


public partial class App : Microsoft.Maui.Controls.Application


public App()



public override IWindow CreateWindow(IActivationState activationState)





return new MainWindow();




In App.Xaml, will work same like xamairn form and will add all the common resources and style

<Application xmlns="http://xamarin.com/schemas/2014/forms"






<!-- Add any additional resources here. -->

<Color x:Key="PageBackgroundColor">White</Color>

<Color x:Key="PrimaryTextColor">Black</Color>

<Color x:Key="GlyphColor">#2B0B98</Color>

<Style TargetType="Label">

<Setter Property="TextColor" Value="{DynamicResource PrimaryTextColor}" />


<Style TargetType="Label" x:Key="Glyph">

<Setter Property="TextColor" Value="{DynamicResource GlyphColor}" />

<Setter Property="FontFamily" Value="IonIcons" />

<Setter Property="FontSize" Value="32" />





Application icon

The application icon is one great improvement, the AppIcon folder will available under the MAUI project and it is just a single SVG, Looks like Maui will just automatically take care of generating all the different icon sizes for different devices.

MAUI Design Screen

AssemblyInfo.cs file is removed from solutions. Main Page Name not changed. The xaml looks like below and you can observe below code the concept of SemanticProperties is added

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"



BackgroundColor="{DynamicResource PageBackgroundColor}">


<StackLayout Padding="{OnPlatform iOS='30,60,30,30', Default='30'}">

<Label Text="Getting started with MAUI Xamarin Forms Application using Visual Studio 2019 Preview 16.10"



HorizontalOptions="CenterAndExpand" />

<Label Text="Welcome to .NET MAUI!"

HorizontalOptions="CenterAndExpand" />


SemanticProperties.Description="Cute dotnet bot waving hi to you!"

Margin="40,0" />




In MainPage.xaml.cs removed using Xamarin.Forms, add an inheritance from IPage, added the Maui namespace

using System;

using Microsoft.Maui;

using Microsoft.Maui.Controls;

using Microsoft.Maui.Controls.Xaml;

namespace HelloMaui



public partial class MainPage : ContentPage, IPage


public MainPage()




public IView View { get => (IView)Content; set => Content = (View)value; }



Restore MAUI Nuget package

Before you will build and run solutions make sure NuGet packages referenced in the configuration file.

Right Click on Solutions > Open Folder in File Explorer

Say Hello to .NET MAUI! A First-Class UI Framework

Make sure global.json and NuGet.config file available before building the solutions

MAUI global.json

global.json file look like below


"sdk": {

"version": "6.0.100-preview.3.21202.5",

"rollForward": "disable",

"allowPrerelease": true



MAUI Nuget.Config

Nuget.Config looks like the below and have the reference key for dotnet6,Xamarin, and public.

<?xml version="1.0" encoding="utf-8"?>



<clear />

<!-- ensure only the sources defined below are used -->

<add key="dotnet6" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json" />

<add key="xamarin" value="https://pkgs.dev.azure.com/azure-public/vside/_packaging/xamarin-impl/nuget/v3/index.json" />

<add key="public" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" />



<add key="globalPackagesFolder" value="packages" />



Build and Run MAUI Android App

Inside Android Folder, not find any MainActivity.cs, only available Resource folder and Androidmanifest file. You will need the Android SDK installed as well as Android SDK Platform 30. When you did a verified MAUI check, SDK was download and installed, if no, a simple way to get this is to install the current Xamarin workload and go to Tools > Android > Android SDK Manager from within Visual Studio.

Say Hello to .NET MAUI! A First-Class UI Framework

Try to click on Run Icon, if you are getting any issue, Right-click on the solution and Select in the open terminal

Say Hello to .NET MAUI! A First-Class UI Framework

Build the MAUI Project, run the below comment in the Visual studio terminal
dotnet build HelloMaui
You can launch the Android project to an attached emulator or device
dotnet build HelloMaui -t:Run -f net6.0-android

Once the build is successful, the Android emulator / on-device application will run like below 

Say Hello to .NET MAUI! A First-Class UI Framework

Build and Run iOS Project in window machine

The build and debug .NET 6 iOS applications from Visual Studio 2019 preview. iOS folder is very clean, you can find Appdelegate.cs, Entitlements.plist, info.plist, Launchscreen.storyboard and Program.CS(Main.cs gets renamed Program.cs)

Xamarin : Step-by-Step Guide To Building .NET Multi-platform App (MAUI) using Visual Studio 2019 Preview 16.10

If while connecting Visual Studio to your Mac through XMA you are prompted to install a different version of the SDK, you can ignore that since it refers to the legacy one. Make sure Xcode 12.4 installed in mac machine,
Xamarin : Step-by-Step Guide To Building .NET Multi-platform App (MAUI) using Visual Studio 2019 Preview 16.10

You can launch the iOS project to an attached iOS Simulator. Initially not working for me run the ios app in windows after that start working.
dotnet build HelloMaui -t:Run -f net6.0-ios
Once the build is successful, the iOS simulator/ Device will show the output like below 

Xamarin : Step-by-Step Guide To Building .NET Multi-platform App (MAUI) using Visual Studio 2019 Preview 16.10


In this article, you learned about the setup Maui development preview environment and you said hello to Maui, Will share details in the next article for setup Visual Studio Code and Visual Studio for Mac. If you have any questions/ feedback/ issues, please write in the comment box

Featured Post

Improving C# Performance by Using AsSpan and Avoiding Substring

During development and everyday use, Substring is often the go-to choice for string manipulation. However, there are cases where Substring c...

MSDEVBUILD - English Channel

MSDEVBUILD - Tamil Channel

Popular Posts