Announcing .NET MAUI Preview 6
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.
59 comments
Is Microsoft use any of that stuff?
I’d expect they’d dogfood their UI toolkits, that would be nice to know and have a list of apps to help sell this new tech
Yes, teams within Office, Azure, Dynamics, and others use .NET for Android and iOS. Check the customers showcase: https://dotnet.microsoft.com/platform/customers
Getting error message. “The project doesn’t know how to run the profile PROJECTNAME.WinUI”. When trying to run on my local machine.
I have updated Visual Studio 2022 to Preview 2, and I have installed the Maui workload. I used the maui-check tool, and got the “everything looks great” message. I created my project using:
Is there some other step that I missed?
You need the Windows App SDK extensions (formerly Project Reunion) for Visual Studio 2022. Once those are available in the marketplace and installed on your system, the WinUI projects should work.
So Project Reunion extension for VS2022 is not in marketplace yet, am I right? Or am I just not able to find it?
These 2 extensions are being updated for Visual Studio 2022. I saw a notification the single project extension was published just moments ago, so it should appear soon in the marketplace. The other extension is also on the way. Keep an eye on the marketplace for them. Appreciate your patience.
both extensions are not installable in VS2022 Preview 2 and I get the same error message
ok, I see the 2022 compatible version of single MSIX packaging tools now, it was just published.
But I still have no idea how to run he WinUI project, as I still get the error message.
The Android app works on my Pixel3a, but toolbar only shows “Android local device” and no longer the phone name.
It’s been three weeks since this article was published, but I still don’t see Windows App SDK extension in the marketplace for VS 2022.
Is it still on it’s way, or is it not needed? I haven’t been able to successfully run a MAUI Preview 6 project since it was released.
Edit: While trying to fix this issue, I was messing around with workloads, but now I am getting this error when I run ‘dotnet workload install maui’
https://marketplace.visualstudio.com/items?itemName=ProjectReunion.MicrosoftSingleProjectMSIXPackagingToolsDev17 is one of the packages just updated.
The following worked for me:
Install Single-project MSIX Packaging Tools for VS 2022 (Preview) – there is a link by James M. below
Ensure in Properties\launchSettings.json –> “commandName”: “MsixPackage”
Doesn’t seem to need a separate ‘Project Reunion for VS 2022’
.NET, MAUI and Blazor are awesome technology!
MAUI Tempate not present in VS 2022(Version 17.0.0 Preview 2.0)
There is a fix for VS22 to pick up templates from .NET workloads that didn’t make the preview 2 release. For the moment, please use the command line to create new projects, and then jump into VS22. This will be resolved in a future build.
How can we exclude some platforms (all apple related for example)?
Same question here – specifically relating to excluding Apple platforms
Moving the platform folders into Platforms folders is nice. It would be more nicer if that folder has a different icon (just like wwwroot folder has in an asp.net core project)
I love that idea as well! It has been proposed, so we’ll see if it can happen by stable release.
this is really a good idea.
Yesterday I updated both VS 2019 Preview, VS2022 and then when I executed “dotnet workload install maui ” it error-ed out in middle . Is there a place where I can go for help. Thanks
I’m in the same boat. I haven’t been able to get Preview 6 since it was announced. This morning, I thought I would try again, but now the workload installation is failing halfway through.
Hi Ravi, Dave, can you create an issue in the .NET MAUI repository and include the logs?
Hi David
Great work here – well done!
Quick question – “dotnet new maui” only supports the WinUI version – what support is there in Preview 6 for Blazor versions of MAUI?
Cheers, Paul.
We include the .NET MAUI Blazor templates as well. Running
dotnet new --list
should show you both maui and maui-blazor.Yup. Thanks David. 😀
David you mentioned that in preview 5 you hoped to be able to say whether the performance goals of MAUI vs Xamarin.Forms were being met. Is that the case yet in preview 6?
The Android AOT packages and performance testing are actively being worked on, so we aren’t ready to report just yet.
“Updated to Windows App SDK 0.8.1 RC.”
on a freshly created project it still shows 0.8 in WinUI cproj
You’re correct, the templates still say 0.8.0. The PR to update those was stuck in CI and didn’t make the templates that shipped yesterday. You can bump the version yourself to 0.8.1.
https://marketplace.visualstudio.com/items?itemName=ProjectReunion.MicrosoftSingleProjectMSIXPackagingToolsDev17 is one of the packages just updated.
Is MVU still planned for this release? We haven’t heard any news about it since last year.
.NET MAUI is foundational to Comet, the MVU experiment we showed at Build 2020. You can get the latest news and updates at https://github.com/dotnet/Comet/.
I know about Comet. I was asking if we could build apps with MVU by the time .NET 6 reaches GA or if it was postponed to .NET 7 since we haven’t heard about it for a while.
Great question… I also research constantly and don’t see people talking about it anymore.