Xamarin MAUI: First iOS, Android and Windows Mobile App using Visual studio 2022
.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.
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.
.NET MAUI IDE
Microsoft provided 3 fantastic IDE Tools to create and develop apps with .NET MAUI and the happy news is MAUI is an open source.
- Visual Studio
- Visual Studio for Mac
- 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.After installation success, Open the Visual Studio IDE
In this sample demo application, I am going to show Android, iOS, and Windows app using MAUI, so Get started with “Create New Project”
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 ++.
In the Configure your new project window, name your project, choose your project location where you need to save, and click the Create button
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.MainPage.XAML
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.
.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
Application Class
The App class derives from the Application classResources
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.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
- Connect same wifi network
- Download and install Visual Studio 2022 with MAUI
Mac Configuration
- Connect same wifi network
- Install Xcode 13.1 ++
- On Network preference > switch on Remote login
Program.cs
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 filesAppdelegate.cs
Each platform will call MauiProgram static class for initialize. On iOS will call as belowThe 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 belowYou 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
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
Hi, if any one getting issue - VS 2022 MAUI template is missing measns
ReplyDeleteOpen CMD
Run following cmd command
dotnet tool install -g Redth.Net.Maui.Check
maui-check
Repeated again, if MAUI didn't appear in VS 2022
if any one getting Workload installation failed: The JSON value could not be converted to
ReplyDeletethis issue is likely to occur when you have previously had Preview 6 installed.
The recommended fix is to manually delete everything under "C:\Program Files\dotnet\metadata\workloads" and then install the workloads manually followed by another run at maui-check:
dotnet workload install maui
after that
maui-check
hope this will work
Hi, I am having issues when it comes to publishing maui apps for deployment? I cannt find a way to create a Windows package without it erroring every time.
ReplyDeletePositive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work. Best Coding Android Wallpapers
ReplyDeleteThanks a lot for sharing this excellent info! I am looking forward to seeing more posts by you as soon as possible! I have judged that you do not compromise on quality. android hidden menu lg
ReplyDeleteA Universityachieved one hour efficient each day for IT support staff, limiting deferrals in arriving at associates to give work guidelines or resolve issues.
ReplyDeletesonnerie
In this way, the augmentation in effectiveness and potential collaboration re-planning which can be cultivated will determinedly influence buyer dedication levels.e usage of met courses of action moreover engages the workforce to be more helpful through limits, for instance, flexible induction to arrange dial extensions and conferencing. phone case manufacturer
ReplyDeleteit was a wonderful chance to visit this kind of site and I am happy to know. thank you so much for giving us a chance to have this opportunity.. https://casas-de-apuestas.mx/betcris/mobile-app/
ReplyDeleteit was a wonderful chance to visit this kind of site and I am happy to know. thank you so much for giving us a chance to have this opportunity.. app codere
ReplyDeleteWonderful Information! Your blog is very nice, such useful information you are sharing. I really like your blog. Financial Advisors Financial Counseling Columbus Financial & Success Coach Money Coach Click Here
ReplyDeleteNice post. This content is simply awesome keep going Please visit our site for startup funding.
ReplyDeleteSatta king fast
Satta result
Nice post. This article amazed me and it really helped me a lot. If you are interested please visit us. Thank you!
ReplyDeleteSatta king fast
Satta result
Nice post. Thank you for your information. I liked the way you wrote the article. It was very straightforward and your knowledge on the subject is fantastic. Financial Advisors Financial Counseling Columbus Financial & Success Coach Money Coach Click Here
ReplyDeletedownload free ringtones click here
ReplyDeleteklingeltonekostenlos with a huge ringtone store
Good job in presenting the correct content with the clear explanation. The content looks real with valid information. Good Work and thank you for sharing the information with us. Money Management Personal Finance Columbus Financial & Success Coach Financial Life Coach Click Here
ReplyDeleteYour blog is very nice, such useful information you are sharing. I really like your blog. Financial Plan Financial Advice Columbus Financial & Success Coach Financial Coaching services Go Here
ReplyDeleteWhat a fantabulous post this has been. Never seen this kind of useful post. I am grateful to you and expect more number of posts like these. Thank you very much. Disawar satta
ReplyDeleteI just found this blog and have high hopes for it to continue. Keep up the great work, its hard to find good ones. I have added to my favorites. Thank You. mejores casas de apuestas méxico
ReplyDelete