.NET MAUI Extensions Templates Visual Studio Xamarin

.NET MAUI – Templates for Visual Studio 2022

.NET MAUI Project and Item templates for Visual Studio 2022 with a VS extension package.

With .NET 6 Preview 6 released last week, .NET MAUI progressed a lot with Workloads, Gestures, Clipping, Alerts, and mainly support for Visual Studio 2022 (with Preview 2.0). But, there is a catch in here. NO templates for VS2022 for now :-(.

For project templates, we still have to rely on the .NET CLI templates for working with VS2022, and switching between CLI and VS IDE is always a pain.

Thankfully, VS extensions will always be there as a rescue in this sort of situation, and this time too. Have published an extension to the VS marketplace, exclusive for VS2022 users, that hosts the MAUI templates.

This can be downloaded from the Visual Studio Marketplace and then installed with VSIX installer or an easy way, install directly from within Visual Studio IDE itself (Extensions -> Manage Extensions or Alt+X+M shortcut). To find this template, search with the maui keyword. Refer to the below screenshot.

Visual Studio Manage Extensions Dialog
Visual Studio – Manage Extensions (.NET MAUI in focus)

Note: To work with MAUI, installing .NET SDK, Visual Studio, and this extension alone is NOT enough. Since MAUI is an optional workload, it won’t get installed with Visual Studio for now. Maybe in a future version. For time being, this has to be manually installed with the below .NET CLI command in an elevated prompt.

dotnet workload install maui

Post-installation, verify whether it is getting listed as a .NET workload using dotnet workload list

.NET MAUI installed as optional workload
.NET MAUI installed as optional workload

And to run the WinUI project in VS2022, ensure this particular VS extension is installed, Single-project MSIX Packaging Tools for VS 2022

This extension has a project template for both MAUI and MAUI Blazor app models and it has been named as:

  • .NET MAUI App (Preview)
  • .NET MAUI Blazor App (Preview)
.NET MAUI project templates in Visual Studio 2022
Visual Studio – Create Project – .NET MAUI templates

And for Item templates, ContentPage (both XAML and C#) and has been named as:

  • Content Page (.NET MAUI)
  • Content Page (C#) (.NET MAUI)
Visual Studio - Add New Item dialog with .NET MAUI Items in focus
Visual Studio – Add New Item dialog

Note: Currently, the project templates target .NET 6 Preview 6, and to support further changes in future .NET 6 releases, an update to this VS extension will be made available accordingly. ContentPage will work with future versions as well, as not much change is expected over there.

Update: Users on VS2019 don’t need to feel left out in this, I got you covered with another extension that hosts the Item templates for ContentPage, in both XAML and C#, find it in the VS Marketplace – .NET MAUI Item Templates.

For cross-platform users, a CLI-based .NET MAUI Item Template is available to install from a NuGet package. And then can be invoked with dotnet new command. For more details, check out the GitHub repository.

Happy coding. Stay connected as we continue to learn and share the experiences from this exciting journey of being a software developer.

One reply on “.NET MAUI – Templates for Visual Studio 2022”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s