Welcome to the Sands of MAUI—newsletter-style issues dedicated to bringing together latest .NET MAUI content relevant to developers.
A particle of sand—tiny and innocuous. But put a lot of sand particles together and we have something big—a force to reckon with. It is the smallest grains of sand that often add up to form massive beaches, dunes and deserts.
Most .NET developers are looking forward to .NET Multi-platform App UI (MAUI)—the evolution of Xamarin.Forms with .NET 6. Going forward, developers should have much more confidence in the technology stack and tools as .NET MAUI empowers native cross-platform solutions on mobile and desktop.
While it is a long flight until we reach the sands of MAUI, developer excitement is palpable in all the news/content as we tinker and prepare for .NET MAUI. Like the grains of sand, every piece of news/article/video/tutorial/stream contributes towards developer knowledge and we grow a community/ecosystem willing to learn and help.
Sands of MAUI is a humble attempt to collect all the .NET MAUI awesomeness in one place. Here's what is noteworthy for the week of February 14, 2022:
.NET MAUI Preview 12 has been out for a while and brought along wonderful enhancements like Shell and Dependency Injection. However, the .NET MAUI Preview 12 Overview video from James Montemagno will have a long shelf life. James starts out covering the .NET MAUI Preview 12 highlights, but jumps into things that are more fundamental—Dependency Injection and using Constructor Injection with the Xamarin.Forms/.NET MAUI Shell.
James has well-known love for using the Shell as a starting point and the .NET Podcast app is a classic showcase to see it in action in a real world app. James also goes on to demonstrate Constructor Dependency Injection in an easy to understand sample—something that will benefit most .NET MAUI developers going forward.
Building a mobile app is only half the battle. The other and arguably the more frustrating, error-prone and time-consuming half is pushing our apps to the iOS/Android/Windows App Stores. Gerald Versluis produced a video about publishing .NET MAUI apps, particularly Android apps to the Google Play Store.
Developers have to produce a signed Android App Bundle (AAB) file that can be uploaded to the Store—Gerald explains the nuances of Android Keystore files.
The Keystore, once generated, should not be misplaced and can be used for producing signed app bundles for updates. Thankfully, CLI tooling helps and Visual Studio 2022 allows for adding Publishing details to the .csproj file itself. Gerald also talks about integrating publishing steps into CI/CD build pipelines and provides pointers for iOS/Windows deployments. Armed with knowledge and the right tools, .NET MAUI developers can look ahead at the app publishing part of the lifecycle with much more confidence and be poised for success.
The BlazorWebView control in .NET MAUI enables developers to embed Blazor web content inside native mobile/desktop apps. However, BlazorWebView is essentially a wrapper that renders the appropriate modern WebView for the given platform and is impartial to web content. Building web apps with React? Turns out, React is welcome in .NET MAUI apps as well.
Most folks will start their React apps with npx create-react-app—but running React apps needs NodeJS which is not a player in the .NET MAUI world. However, if we do a production build with npm run build, we're asking for all assets to be minified, bundled and be ready for deployment. We could then start up a .NET MAUI Blazor project, copy over the React build artifacts into the wwwroot folder and switch out the Blazor index.html file with the one from React app—a curious developer tried just that. Turns out, 'compiled' React apps work just fine in .NET MAUI through the WebView and custom React components, like those from KendoReact, are welcome as well.
Web technologies, including .NET and JS SPA frameworks, now have an optimized way into native apps and that should provide more options as developers plot application stack modernization with .NET 6 and .NET MAUI.
Andreas Nesheim wrote up a wonderful article on some of the benefits of .NET MAUI—things that were a big hassle in Xamarin world end up being no brainers in .NET MAUI. Andreas starts out with how we handle Image resizing and manage Splash Screens today—just not fun to cater to each individual platform. .NET MAUI makes things easier with Resizetizer tool built-in and shared Resources of Fonts, Icons and Splash Screens.
Messy .csproj files are a thing of history with clean SDK-style projects in .NET MAUI, making merge conflicts less likely. We are also not limited with .NET Standard 2.0 language dependencies—the latest .NET MAUI project templates use the full power of C# 10, like File-scoped Namespaces and Global Usings.
Most platform-specific initializations or Dependency Injection can be done in MauiProgram.cs itself and it is also much easier to customize UI elements across platforms. .NET MAUI addresses much of the existing developer pain points and promises a better tomorrow for cross-platform .NET development.
Gerald Versluis, Mark Allibone and Steven Thewissen host the Null Pointer podcast—an opinionated podcast on development, tech and every day struggles. Daniel Hindrikes was on as guest for a recent Null Pointers podcast episode to talk about all things Blazor—what's happening with Blazor today and what lies ahead tomorrow.
Daniel shared his experiences writing Blazor apps for both client-side using WebAssembly vs server-side over a SignalR bridge. The excitement is palpable with Blazor now being welcome on native mobile/desktop apps, thanks to .NET MAUI, thus enabling lot more code sharing.
While Blazor Hybrid apps may be what's getting the most attention now, there's no love lost for Mobile Blazor Bindings—the experimental way to write native UI across platforms using Blazor/Razor syntax. Blazor is a wonderful story for .NET developers and the future is just getting better.
That's it for now.
We'll see you next week with more awesome content relevant to .NET MAUI.
Sam Basu is a technologist, author, speaker, Microsoft MVP, gadget-lover and Progress Developer Advocate for Telerik products. With a long developer background, he now spends much of his time advocating modern web/mobile/cloud development platforms on Microsoft/Telerik technology stacks. His spare times call for travel, fast cars, cricket and culinary adventures with the family. You can find him on the internet.
Subscribe to be the first to get our expert-written articles and tutorials for developers!