Today with .NET 6 Preview 6 we are shipping our latest progress on .NET Multi-platform App UI (MAUI). This release we are all-in on Visual Studio 2022 Preview 2. This also marks the first time we are shipping .NET MAUI as a workload installation. Several new capabilities are now available including gestures, modal pages, view clipping, native alerts, flex layout, and more. Single project also continues to be improved along with adopting the latest release of the Windows App SDK and Visual Studio extensions. Let’s take a deeper look.
Workload Installation
As part of .NET unification, we have introduced the concept of SDK workloads to enable specific developer scenarios on top of the .NET SDK you’ve installed. In preview 4 the underlying SDKs for Android, iOS, macOS, and Mac Catalyst were enabled, and now in preview 6 we are introducing the maui
, maui-mobile
, and maui-desktop
workloads. The first will acquire and install all the required SDKs for building .NET MAUI applications. If you are only wanting to target mobile or desktop, you can choose those individually.
In the near future Visual Studio 2022 will include these with its installer. To use them today, jump into your favorite CLI. First, take a look at what you have installed already:
dotnet sdk check
This reports what has been installed via the .NET SDK installer itself. Now to see the additional workloads run:
dotnet workload list
To then install .NET MAUI you can execute:
dotnet workload install maui
What about the
maui-check
dotnet tool? We will continue to updatemaui-check
with each release as it does additional validation of your development environment to help you be successful: checking for OpenJDK, emulators, Xcode, Visual Studio versions, and more.
For more information about mobile and desktop workloads, read details here.
New .NET MAUI Capabilities
As you can see on our status report, we are very close to being completely green for enabling features in .NET MAUI. Let’s highlight a few of the newcomers.
Gestures
Gesture recognizers allow you to apply tap, pinch, pan, swipe, and drag-and-drop to any view instance. You can apply them easily in XAML:
<Grid>
<Grid.GestureRecognizers>
<TapGestureRecognizer NumberOfTapsRequired="2" Command="{Binding OnTileTapped}" />
</Grid.GestureRecognizers>
<!-- Grid content -->
</Grid>
In this example, when the weather widget tile is double-tapped, it simulates a refresh with a fade-out, fade-in animation.
Clipping
When you need to mask content you can now add shapes to the clipping region of a layout or view. The most common use for this is to make a circle image.
<Image Source="face.png">
<Image.Clip>
<EllipseGeometry RadiusX="80"
RadiusY="80"
Center="80,80" />
</Image.Clip>
</Image>
Native Alerts
Each platform has a native way of displaying alerts to users. These can be simple informational popups, simple input forms, and even action sheets with multiple options to guide a user. These are available from any Page
in a .NET MAUI application.
await DisplayAlert ("Alert", "You have been alerted", "OK");
These are just a few of the controls and layouts updated in preview 6. For a complete list, check out the commit log on GitHub. A few sweeping changes for layout, borders, corners, and shadows will be arriving in preview 7.
Single Project and Windows
We’ve made a few updates to single project based on developer feedback and Windows support to adopt the latest features. Some of you have been following along with each release, and we love that! Thank you for providing your feedback and engaging with us on GitHub and Discord. So, what has changed in preview 6 that you’ll need to update in your existing solutions?
- The NuGet package is replaced with the .NET MAUI workload (
<UseMaui>true</UseMaui>
in the .csproj). - Single project solutions now nest individual platforms within a “Platforms” folder for tidy organization.
- Updated to Windows App SDK 0.8.1 RC. Use the latest Visual Studio 2022 compatible extension from the marketplace.
Get Started Today
First thing’s first, install .NET 6 Preview 6. Now add the maui
workload using the command above. Also make sure you have updated to the latest preview of Visual Studio 2022, or if you’re on macOS you can continue using CLI and your favorite code editor as we await the debut of Visual Studio for Mac 2022.
Ready? Create new app from the command line and then open the solution in Visual Studio 2022.
dotnet new maui -n HelloPreview6
In future versions of Visual Studio 2022 the .NET MAUI templates will appear in the File > New list. Until then, the CLI is your good friend.
Xcode 13 Beta 1 is the new minimum requirement for iOS and macOS. For additional information about getting started with .NET MAUI, refer to our documentation.
Feedback Welcome
Please let us know about your experiences using .NET MAUI Preview 6 to create new applications by engaging with us on GitHub at dotnet/maui.
For a look at what is coming in future releases, visit our product roadmap.
Hi all,
I am trying to run a sample MAUI app on the windows 10 desktop (HelloMaui.WinUI).
I am using VS2022 preview(Community Edition) and my maui-check says "- Congratulations, everything looks great!"
But facing the below exception while trying to run the application. (Any help is greatly appreciated)
Unhandled exception. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.Runtime.InteropServices.COMException (0x80040154): Class not registered (0x80040154 (REGDB_E_CLASSNOTREG))
at WinRT.BaseActivationFactory..ctor(String...
Why App.Current.MainPage is not working in this release?
I am making a sample app in MAUI. How do you Navigate from one Page to another in MAUI.
Seems App.Current.MainPage = new NavigationPage(new MainPage()); is not working. Please let me know if I am missing anything. Also Coudn’t found some controls like BusyIndicator in MAUI.
Thanks
Hello David, I'd just like to clarify a few things about macOS support.
In response to a comment on the blog announcing Preview 3 you said:
Mac is in there. You can use Mac Catalyst which is what .NET MAUI uses by default, or you can use the Cocoa/AppKit Mac SDK that also ships with .NET 6.
Then in response to a comment on the blog announcing Preview 4 you said:
Hi Michael, it is native with Mac Catalyst....
It feels like Desktop is the junior partner with .Net MAU. All your examples seem to be for apps with a mobile design in mind. I'd really like to consider maui for a major desktop app (Windows/MacOS). Where can I go to engage with this new platform & understand how to build navigation for a big desktop app with multiple pages, docking, context menus etc. Am I too early in the game, is maui the...
There are alternatives for multi-platform .NET desktop applications. One such project is Avalonia, which supports “WPF-style” applications for Windows, Linux, and MacOS.
Thanks for sharing, I’m going to take a look at that! I have the same issue Russell has. I want to work on a big multi-platform desktop application but all the support seems to be going to (those darn kids) mobile apps.
Hi guys! I am very impressed with the .NET MAUI but what the future of the Xamarin Native applications? How long Microsoft will support this approach?
I found that Xamarin Forms will be supported for the next year after the .NET 6 release (as I understand until November 2022). But it is not clear about Xamarin Native. Will I be able to have 2 different projects for Android and iOS in one solution and build...
I don’t think many things will changed with Xamarin Native.
MAUI is more about Xamarin Forms, to redo what’s so bad in Xamarin Forms before. Though they’re still going through mono framework, which means these controls have to be rendered through Xamarin Native layer, so as long as MAUI is still alive, Xamarin Native is still an approach.
Thank you, Unamed000, for your answer! I’m also understand situation like you described, but wanted to get a response from a Microsoft official like David Ortinau.
I really think Microsoft should try to use the MAUI to create their applications like "Microsoft Teams" or Outlooks first. To experiment the native controls before finally releasing a stable release for MAUI later ....
I doubt if somebody could make some advanced chat UI as smooth as native platforms with current state of Xamarin Forms. One of the most important control is the CollectionView and a lot of people have different issues about it so...
Hello Everyone
I have problem when I try to use this command: dotnet workload install maui
error:Read more
Failed to update the advertising manifest microsoft.net.sdk.android: Failed to fetch results from V2 feed at 'https://nuget.telerik.com/nuget/FindPackagesById()?id='microsoft.net.sdk.android.manifest-6.0.100'&semVerLevel=2.0.0' with following message : Response status code does not indicate success: 401 (Logon failed.)..
Failed to update the advertising manifest microsoft.net.sdk.ios: Failed to fetch results from V2 feed at 'https://nuget.telerik.com/nuget/FindPackagesById()?id='microsoft.net.sdk.ios.manifest-6.0.100'&semVerLevel=2.0.0' with following message : Response status code does not indicate success: 401 (Logon failed.)..
I've updated "maui-check" and run it, without executing "dotnet workload install maui".
Then I've run "dotnet workload install microsoft-net-sdk-blazorwebassembly-aot". The execution aborted (too bad I don't have the error).
Running"dotnet workload list" shows an empty list.
Trying to fix it, I've run "dotnet workload install maui", but the execution aborted too:
Installing pack Microsoft.Android.Sdk version 30.0.100-preview.6.62...
Workload installation failed, rolling back installed packs...
...
Workload installation failed: Number of entries expected in End Of Central Directory...
Never mind, I’ve solved.
I’ve run “dotnet workload install maui” again and this time it succeeded.
Maybe because I’ve used the Android SDK Manager to install Android 11.0 – R (API Level 30), specifically the “Google API Intel x86 Atom64 System Image” that wasn’t installed, or because I closed the VS 2022 instance that on previuos run was open.
I am trying to convert a Xamarin.Forms ListView to .NET MAUI, but binding is not working.
Are there any samples on .NET MAUI ListView? I can’t find any.