.NET MAUI Extensions Templates Visual Studio Xamarin

.NET MAUI – Templates for Visual Studio 2022

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

With .NET 6 Preview 6 released on Jul 14, 2021, and now Preview 7 released on Aug 10, 2021, .NET MAUI progressed a lot with Workloads, Gestures, Clipping, Alerts, New Layouts, and mainly first-class support for Visual Studio 2022 (with Preview 3.x). But, there is a catch in here. NO item templates for Visual Studio for now :-(.

Update: This extension is now updated to support .NET MAUI Preview 10 with VS2022 Preview (17.1.0 Preview 1.0) IDE and .NET MAUI (Preview) Mobile Development workload installed. This can be downloaded and installed from the same link mentioned in this article.

Update: A more advanced all-in-one .NET MAUI App project template is now available to install. Check out this article for more details.

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, for VS2022 users, that hosts the MAUI templates.

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 and ContentView, in both XAML and C#, find it in the VS Marketplace – .NET MAUI Project and Item Templates.

This .NET MAUI Project and Item Templates extension can be downloaded from the VS 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 extension, 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

Coming back, this extension has a project template for both MAUI and MAUI Blazor app models and it has been named as:

  • .NET MAUI App (Preview 7)
  • .NET MAUI App (C#) (Preview 7)
  • .NET MAUI Blazor App (Preview 7)
  • .NET MAUI Class Library (Preview 7)
Visual Studio - Create Project - .NET MAUI templates
Visual Studio – Create Project – .NET MAUI Templates

And reg. Item templates:

ContentPage (both XAML and C#) and has been named as:

  • Content Page (.NET MAUI)
  • Content Page (C#) (.NET MAUI)

ContentView (both XAML and C#) and has been named as:

  • Content View (.NET MAUI)
  • Content View (C#) (.NET MAUI)

A page for defining app visual hierarchy with Shell and a page for managing resources with Resource Dictionary, both in XAML.

And now, this VS2022 extension is loaded with 25+ C# and XAML code snippets to improve the developer productivity as most of the snippets are backward compatible with Xamarin.Forms too. For the list of available snippets and their shortcuts with output format, take a look at this Getting Started guide. VS2019 extension will soon be enabled with these snippets.

Visual Studio - Add New Item dialog - MAUI Templates in focus
Visual Studio – Add New Item dialog – MAUI Templates in focus

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

For cross-platform users, a CLI-based .NET MAUI Templates 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.


By Vijay Anand E G

A software professional with over a decade long industry experience in developing products that spans across desktop, mobile, and web.

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

Comments are closed.