Migrate to .NET MAUI from Xamarin.Forms Faster Than Ever - .NET Upgrade Assistant for Visual Studio
ฝัง
- เผยแพร่เมื่อ 12 ก.ค. 2024
- The time is now to start migrating, upgrading, and updating your Xamairn & Xamarin.Forms apps to .NET & .NET MAUI! It has also never been easier to make this transition thanks to the new .NET Upgrade Assistant built directly into Visual Studio 2022. I set out to give you a complete guide and walk-through of a real-world application from start to finish. This will cover custom fonts, NuGet packages, Xamarin.Essentials, Xamarin Community Toolkit, Images, and more! By the end of this video, you will be completely ready to start and finish your migration!
Relevant Videos:
• Learn .NET MAUI - Full...
• Singleton vs Transient...
• A Better Pub/Sub Messe...
• .NET MAUI Tutorial for...
• Accessing Native Platf...
Links:
Code: github.com/jamesmontemagno/My...
.NET MAUI Docs: learn.microsoft.com/dotnet/maui/
Migration Docs: learn.microsoft.com/dotnet/ma...
.NET MAUI Dependency Injection: learn.microsoft.com/dotnet/ar...
.NET Upgrade Assistant: dotnet.microsoft.com/en-us/pl...
Blog on Upgrading Xamarin.iOS & Android to .NET: devblogs.microsoft.com/xamari...
Join this channel to get access to perks:
/ @jamesmontemagno
👕 Buy some swag! - jamesmontemagno.myspreadshop....
☕️ Buy me a coffee - www.buymeacoffee.com/jamesmon...
Follow:
👨💻 GitHub: github.com/jamesmontemagno
🦜 Twitter: / jamesmontemagno
📄 Website: www.montemagno.com
📰 Newsletter: newsletter.montemagno.com/
Chapters:
00:00 - Intro
01:00 - Migration Considerations for Xamarin.Forms
03:00 - App & Code Walkthrough
03:50 - Install & Use .NET Upgrade Assistant
09:15 - Fixing Complication Errors (differences between Xamarin.Forms and .NET MAUI)
12:45 - Merge code into new .NET MAUI Application
19:00 - Fonts, Images, and other Resources
23:30 - Platform Specific Code & Dependency Service/Injection
28:08 - Documentation overview for Migration
29:25 - Wrap-up and final thoughts
Disclaimer: This channel, videos, and streams are created in my spare time and are a product of me... James Montemagno! They are NOT officially affiliated or endorsed by Microsoft (my employer) in any way. Opinions and views are my own.
What is on my hat? It is the CLE clothing logo because I am from Cleveland! Checkout their awesome CLE merch: cleclothingco.myshopify.com/
What is that art on my wall? It is an original piece from the French street artist Gregos of La Butte Montmartre: / bcez1onhiqx
My Setup:
📷 Canon M50 Mark II - amzn.to/3P8R7lp
💡 Nanoleaf Elements Lights - amzn.to/3umwJVW
🎙 Blue Spark Microphone - amzn.to/3qgtYkq
🎙 Blue Pop Filter - amzn.to/3jEWM3r
🤳 Rode Microphone Arm - amzn.to/2Z68AlE
🎧 Sony MDR7306 Headphones - amzn.to/372jxta
📲 Stream Deck - amzn.to/373Uk1n
🖱 MX Master 2S Mouse - amzn.to/3d7J2gj
⌨️ Tecware Phantom Keyboard - amzn.to/3aUP4y9
#dotnetmaui #xamarinforms #visualstudio #dotnet - วิทยาศาสตร์และเทคโนโลยี
Nice video for those who were using xamarin forms. Still no news on the InAppBilling video? 😮
Great video, James! Thanks for making such content - it makes our lives easier) BTW, just in case you will have a spare minute, it would be really great to hear your thoughts on the latest announcement of VS for mac retirement. How the development on mac will now look like? I do know lot of people that just bought the mac machines in order to able to develop mobile apps with xamarin/maui. Should they now switch to Rider as alternative?
I think the blog outlined it fairly well, but a move towards VS Code as the main go to is what I’ll be doing. Or you can use a Windows VM with VS or a Dev Box is another options. Or rider as well is a great option.
Rider
This video drops just in time as I finish up a month-long conversion of our Xamarin.Forms app to MAUI.😂It's been a ride! Not a very smooth one unfortunately.
Can you please share your experience and pain areas?
Please share your suggestions. Ive just started with the upgrade.
@@divanvanzyl7545 Before migrating evaluate all of your 3rd party libraries to see if they support MAUI. I eliminated a bunch of them with out-of-the-box features. Create a new MAUI app and migrate the code. It's the only way to do it that worked at all for me. Expect MANY build errors at first. I worked through at least 600 errors before the app would build (and that's with running the upgrade tool already). When it finally built then I got a slew of XAML parse errors before the app would run. If you have a lot of Xamarin.Forms custom renderers expect to spend a lot of time converting them to handlers/mappers. I ended up eliminating 90% of my custom renderers. Also expect to spend time tweaking the UI. For me a lot of the views looks different mainly because I had to switch to the new Border control from a 3rd party control we used in XF. That's all I can think of off the top of my head. I'm actually still working on the upgrade right now trying to figure out why the Mopups MAUI popup library looks broken in iOS but not Android. Maybe things will go smoother for you. Good luck!
@@divanvanzyl7545 I have also started migration. I have created seperate MAUI project and started copy pasting each code and resolving compile time issue.
Me too, my Xamarin forms project contains about 70 pages, sqlite, push notifications, old wcf service references, and is being tricky when it comes to getting the new 'Core' upgraded class library to build alongside the 'old' platform folders. One issue I'm getting when trying to pair to Mac concerns it claiming that there are duplicate manifest ID (16.4.8825-net8-rc1 for maccatalyst) that conflicts with the same ID but for iOS within the c:\program files\dotnet\sdk-manifests\8.0.100-rc1 folder. Baffled!
Hi James, great video thank you. Is Maui production ready? There are a lot of posts saying it is full of bugs. Is this true?
We got stuck on one of the first steps of the upgrade assistant and can't find any information on how to fix. The project template "maui application" doesn't exist. We have downloaded ".NET MAUI Project and Item Templates" closed the program and tried again. We are on the latest version of Visual Studio 2022. Any help anyone?
If we don't include iOS Android Targets and Unit Test projects our XF app sln has 16 projects. Can the Upgrade Assistant be asked to target them all at once? Do we manually upgrade each project from the bottom up?
Hi James. Are you aware that the app may run in the iOS simulator but won't build (i.e., archive for publishing)? MyMauiCoffeeApp/MyCoffeeApp.Shared/obj/project.assets.json' doesn't have a target for 'net7.0-ios'. I'm facing the same issue with an app we're migrating following the steps in this video. Even adding a blank .net standard class library project to an empty MAUI app results in a build error.
Good evening! Thank you for this great video!! We are trying to migrate our app to MAUI and we see that await Application.Current.SavePropertiesAsync(); is obsolete, do we have to user another thing or simply the Preferencies are saved automtically? THank you very much
I just ran the upgrade assistant on one of my projects. It appears to be mostly successful and did not give any errors related to the migration. However, it did not create a Platforms folder or any of its expected contents. Dotnet 8 is what I migrated to.
You need to create those separately. The migration tool only creates a library.
James - is MAUI in trouble? VS for Mac retiring really concerns me. I've poured a lot of time and resources into MAUI. It seems like a really small team, and Microsoft is being quiet about whether or not it's really committed to it.
.NET MAUI is full steam ahead. The team has a big push in .NET 8 and the new VS Code extension
Can you make one video in dotnet Maui android, that how we read OTP automatically.
Hello boss can you please make a video on Xamarin native to .Net MAUI
Do I need to upgrade my referenced xamarin forms nuget packages beforehand? To be compiled the main project?
When you upgrade they should be uninstalled automatically.
James, I am trying to convert my xamarin forms app to MAUI. I am trying to follow your video but when I select upgrade, the project template dropdown shows only "Empty project". I don't see "Maui application" like you show in your video
2 questions… do you have the latest version of upgrade assistant? Check extensions manager.
Are you selecting the net standard shared code project?
If still can’t do it, try the cli
We need an updated Admob package for Maui!
Should be updated - www.nuget.org/packages/Xamarin.GooglePlayServices.Ads
Not much has changed for integration, good post: startdebugging.net/2023/11/how-to-add-admob-to-your-maui-app/
James, or if anyone else can help. When we do this, the Project template “maui application” doesn’t exist. What are we doing wrong?
.NET MAUI itself was full of bugs when I tested it around Feb 2022. A simple label with multi-binding was crashing the app. After investigation it was a well old known bug, lol.
At the time I thought that people saying to wait a couple of years was exagerating... I'd say that in 2026 MAUI XAML should be ready. But wait, Xamarin form end of support date is in may 2024, 😉.
Gif images not play animation android platform?
Do you not specify Android Version in Application>Android Targets> Target Android Framework?
It is specified in the csproj now for you.
Why can’t we upgrade XamarinAndroid and XamariniOS using the tool? I am asking it because I tried to upgrade it using the tool.
Moving from XA and XiOS is actually pretty easy just change the csproj for the most part. It is a simple migration as hardly any api changes. Take a look at the docs I linked to.
Hi @all if any project is complete in Xamarin project so is this mendatory to migrate in .net MAUI
I dont have an "Upgrade" option when right-clicking on my Xamarin.Forms .csproj file. How do I address this?
Did you install the upgrade assistant extension?
Is NET Upgrade Assistant going to be on visual studio 2022 for MAC ??
You can use the CLI on a Mac
.NET Upgrade Assistant on Mac and Linux?? #dotnetmaui #coding #visualstudio
is this working if using third party nuget ? like telerik for example
It wont know how to upgrade those specifically, so you will need to go and grab some the latest nugets from them.
How to do MAUI migration using MAC machine?
There is a CLI version of the tool available
Can your dependencies target .net 6 or 7 if your .net maui app targets .net 8?
of course!
Ran it on the app I'm current working on and it's come up with > 150k errors! 😅And that's after I've already manually separated anything that's not a View into a shared library that's not reliant on Xamarin.Forms.
You got this!!!! 1 error at a time :)
Is there mendatory to migrate the Xamarin form into MAUI is any project is completed in Xamarin form please suggest me
Hey, Xamarin is being deprecated on May 31, 2024 so eventually if you don't migrate you will not be able to submit to the app stores and there will be no more security fixes or bugfixes. So it is advised to migrate.
@@MilfH69 Thanks for reply but I have a doubt i.e if I follow the Microsoft tool for migrate there is lot of issue I am facing in my project and some time compiler is not detect and tell the proper error so is there any another way except manual migration and how we migrate Xamarin to MAUI in Mac
I got error as There are no target frameworks found to which your project could be upgraded.
Had the same problem. You can try the following: In the upgrade assistant choose "Upgrade project features" and then "Convert project to SDK style". After this, the installed frameworks were shown.
*than