Codementor Events

Migration from Xamarin.Forms to .NET MAUI

Published Aug 20, 2024
Migration from Xamarin.Forms to .NET MAUI

I recently successfully migrated a mobile app 📲 from Xamarin.Forms to its successor, .NET MAUI, for an appreciated client of mine. ✅

The migration was necessary, as Xamarin was already at its End of Life since May 1, 2024 and Visual Studio for Mac retires at the end of this month (31st of August 2024).⌛️

It was time to apply the much promoted Visual Studio Code coding tool for a production application on my MacBook 💻 and start the migration.

The application isn't very large (as in, not many screens), but uses BLE to control trendy in-house fireplaces that simulate fire using water and lights that my client's customers can use to fine-tune its intensity, and turn it on and off.

Before the actual migration, I used a widely supported open-source BLE library to replace the custom native Android- and iPhone code to control the fireplaces. This turned out to be a great choice, as the library was already supporting .NET MAUI.

After setting up my Visual Code instance with the required extensions for .NET and .NET MAUI development, I created a new .NET MAUI project and started moving over the necessary logic, classes and models.

📚 The documentation on what needed to be migrated and changed to get the .NET MAUI app starting up properly, and its XAML files and configuration to be configured correctly, proved quite complete.

The app didn't have many custom renderers as its interface is straight on to keep it easy and understandable, so there wasn't too much work on that part.

👀 A while ago, James Montemagno from Microsoft shared an update on LinkedIn how to activate the live preview feature, which sped up testing and tweaking the interface after migrating. It's just so much easier to edit Xaml and see if your interface and elements aligns properly.

📦 Being pampered by using Visual Studio and Visual Studio for Mac's easy interface to archive and deliver a working (and tested) app, using Visual Studio Code to do the same proved more of a search.

Gerald Versluis' tip on the .NET MAUI - Archive / Publish extension proved valuable as it made packing the app for Android and iOS a LOT easier.

Having completed the migration successfully, and now being able to use Visual Studio Code and knowing how to package and deploy an app taught me a lot and proved to be well documented and easier to perform than initially expected.

🙏🏻 Kudos to the .NET MAUI team for their valuable work and sharing the latest and greatest. As well as all the contributors that work behind the scenes.

As a 22+ year developer, with over 8 years of cross-platform development, I still love to learn and use my passion for coding, consulting, mentoring and creating products to provide value to others.
I'm thankful I got to work at a large financial institute as developer, a large IT company as dev and consultant, and a startup to learn the ropes about product and service development besides staying eager as a coder.

What was your recent learning moment or a project that could need a (seasoned but) fresh mind to look at your product?

Discover and read more posts from Edwin Klesman
get started