.NET MAUI Project Templates, Item Templates, and Code Snippets for Visual Studio 2022
Recognized as one of the Top Free Extensions for Visual Studio 2022 by Visual Studio Magazine, an acclaimed tech site.
Stay connected with my Developer Thoughts blog for more insights on .NET MAUI and Blazor.
This VS extension is loaded with Project Templates, Item Templates, and Code Snippets for working with .NET MAUI in Visual Studio 2022.
This has Project Templates for:
- .NET MAUI App - An All-in-One App Project Template - For more details, take a look at this article
- .NET MAUI Class Library
- Shared Class Library (Xamarin.Forms and .NET MAUI)
And Item Templates for:
ContentPage and ContentView, in XAML, C#, and Razor.
Shell Page for defining app visual hierarchy in XAML, C#, and Razor.
Resource Dictionary for managing resources in XAML.
- Content Page
- Content Page (C#)
- Content Page (Razor)
- Content Page with BlazorWebView
- Content Page with BlazorWebView (C#)
- Content Page with ViewModel
- Content Page (C#) with ViewModel
- Content View
- Content View (C#)
- Content View (Razor)
- Resource Dictionary
- Resource Dictionary (XAML only)
- Shell Page
- Shell Page (C#)
- Shell Page (Razor)
- Custom View and Handler (Regular)
- Handler definitions generated in the Platforms folder
- Custom View and Handler (Cond.)
- Handler definitions are generated in the same folder in a conditional compilation format
- Custom View and Renderer (Regular)
- Renderer definitions generated in the Platforms folder
- Custom View and Renderer (Cond.)
- Renderer definitions generated in the same folder in a conditional compilation format
- Comet Page (C#)
- Partial Class (C#)
- Made available in the section titled
Code
- For the Cond. type template to work properly, ensure Conditional Compilation is enabled as mentioned in detail here
C# and XAML Code Snippets
Note: Currently, the project templates target .NET MAUI 6/7 GA and its Service Releases, .NET 8 Previews (VS2022 17.3.0 or higher), and to support further changes in newer .NET MAUI releases, an update to this VS extension will be made available accordingly.
Version History (latest on top):
- .NET MAUI workload is now a prerequisite for installing this extension (As of now this is tested to work on VS2022 17.3.0 or a later version).
4.1.0.0:
- Templates updated for .NET 8 RC1
- Project file enhancements
- The default value for the Framework parameter is now updated as net8.0
4.0.1.0:
4.0.0.0:
- .NET MAUI App
F# project template with Fabulous
- Not all options in the
C# template are supported in the F# template
3.6.0.0:
- Templates updated for .NET 8 Preview 7
3.5.0.0:
- Templates updated for .NET 8 Preview 6
- CommunityToolkit.Maui.Maps for the Windows platform now work on .NET 8 as well
- Opting for this will include the NuGet package and configure it in the .NET MAUI startup in MauiProgram.cs
3.4.1.0:
- Templates updated for .NET 8 Preview 5
- Added support for the newly released CommunityToolkit.Maui.Maps NuGet package to support the Maps feature on the Windows platform.
- Opting for this will include the NuGet package and configure it in the .NET MAUI startup in
MauiProgram.cs
- Update your Bing Maps API Key for it to work properly, Visit Bing Maps Portal to generate one.
Note: For now, this is supported only on .NET 7. Support for .NET 8 Preview in a future release.
3.3.2.0:
- For library projects on .NET 8, explicit package references for
Microsoft.Maui.* NuGet packages
- Made changes in the source files of Hybrid and Reactor project templates
3.3.0.0:
3.2.4.0:
- Fixed the issue of the
_Imports.razor file getting excluded while creating a project in the Razor design pattern
3.2.3.0:
- Platforms folder filtered out based on the target platform opted-in for .NET MAUI App and Class Library project
3.2.2.0:
- Conditionally defined supported platform properties based on the target platform opted-in for .NET MAUI Class Library as well
3.2.1.0:
- Templates updated to support .NET 8 Preview 3
3.2.0.0:
- While creating a Blazor Hybrid App, an option to abstract the Razor components as a separate Razor class library
- While targeting
.NET 8 , the StartPath property is set to load a Razor component other than the one defined with the default route address of /
- An item template for ContentPage with BlazorWebView, both in XAML and C#
3.1.0.0:
- Added support for Markup, Razor Bindings, Comet, and Reactor AppModels in the All-in-One .NET MAUI App project template
- Option to use MVVM and Compiled Bindings on the supported AppModels (except Web and MVU)
- New Item Templates for Comet, Razor Bindings (Page, View, and Shell), and Shell (C#)
- Removed the explicit C# App project template, instead use the .NET MAUI App template with the Design Pattern option selected as Markup for the same feature with more options
3.0.0.0:
- Templates updated to support .NET 8 Preview 1.
2.4.0.0:
- CommunityToolkit.Maui.Markup NuGet package bumped to v3.0.0 that supports TypedBindings
- Introduced an ItemTemplate for C# Class (Partial). Made available in the section titled
Code
2.3.1.0:
2.3.0.0:
- Ability to add a reference to CommunityToolkit.Maui.MediaElement NuGet package and configure it in the startup pipeline for playing audio/video in a .NET MAUI app
- Dependent packages have been updated to reference the latest stable version
- CommunityToolkit.Maui - v4.0.0
- CommunityToolkit.Mvvm - v8.1.0
2.2.0.0:
- Template package updated to support .NET 7 SR1 (v7.0.52).
- Base framework is also included as a target (net6.0/net7.0) to the .NET MAUI App project template when the
Target Platform is set to All .
2.1.3.0:
- The target-platform parameter is now updated as a multi-choice value. Can be opted-in according to the need.
- And a little housekeeping to improve the reliability of the templates.
2.1.1.1:
Template package updated to support newly released .NET 7 NuGet dependencies
For App project targeting .NET 7, an option to add and configure Maui Foldable NuGet package (Apps that support Dual Screen)
- Note: If the project targets .NET 6, selecting the Foldable/Maps option will NOT have any impact.
2.1.0.0:
- Templates have been updated to support .NET MAUI on .NET 7 GA (an STS release).
2.0.3.0:
Templates have been updated to support .NET MAUI on .NET 7 RC2 (Preview Release)
A parameter named --target-platform | -tp has been introduced that takes any one of the following values (with All being the default value).
- All - Targets all possible .NET MAUI-supported platforms.
- Android - Targets Android platform.
- iOS - Targets iOS platform.
- macOS - Targets macOS platform via Mac Catalyst.
- Windows - Targets Windows platform.
- Tizen - Targets Tizen platform.
- Mobile - Targets Android and iOS platforms.
- Desktop - Targets Windows and macOS platforms.
- Apple - Targets iOS and macOS platforms.
2.0.0.0:
- Templates have been updated to support .NET MAUI on .NET 7 (RC1 - Preview Release) (
--framework / -f parameter).
- Maps can be opted-in as it is now defined as yet another project creation option (
--include-maps / -inm parameter)
1.7.6.3:
- CommunityToolkit.Mvvm NuGet package is out of preview and now stable, hence the package version (8.0.0) is updated.
1.7.6.1:
1.7.5.0:
Added the following new Item Templates for creating a Custom View definition made available in the MAUI section in the Add New Item dialog.
- Custom View and Handler (Regular) (.NET MAUI)
- Custom View and Handler (Cond.) (.NET MAUI)
- Custom View and Renderer (Regular) (.NET MAUI)
- Custom View and Renderer (Cond.) (.NET MAUI)
- Regular type template generates the Handler / Renderer source files in the Platforms folder whereas Cond. type template houses them in a single folder.
- For conditional type format, ensure Conditional Compilation is configured in the project file for the build to succeed. An additional option is provided during project creation in both VS IDE and CLI (or manually thereafter).
Added the option to configure Conditional Compilation so that platform source files can be defined anywhere in the project provided they follow a naming convention as mentioned below. This will allow maintaining related source files in the same place, especially MAUI Handlers.
- *.Standard.cs - Files targeting the BCL
- *.Android.cs - Files specific to Android
- *.iOS.cs - Files shared with both iOS and MacCatalyst
- *.MacCatalyst.cs - Files specific to MacCatalyst
- *.Tizen.cs - Files specific to Tizen
- *.Windows.cs - Files specific to Windows
Parameter name: -cc | --conditional-compilation
1.7.1.0:
- Introduced a new parameter to include all supported packages in the Shared Class Library template, which will add a reference to all 6 supported NuGet packages
- Parameter name:
-asp | --all-supported-packages
- Included
IsExternalInit type definition to support C# Records while compiling for Xamarin.Forms
- CommunityToolkit.Mvvm NuGet package version updated to support the latest preview release
1.7.0.0:
- Templates have been updated to .NET MAUI GA, stable release version
- .NET MAUI workload is now a prerequisite for installing this extension
- Also, check out the newly included project template for creating a Shared Class Library that produces assemblies targeting Xamarin.Forms and .NET MAUI
- With C# Markup, Global usings, and Compiler directives, both
Xamarin.Forms and .NET MAUI can be targeted from a single project
1.6.0.0:
- Included a Project Template for creating a
Shared Class Library that produces assemblies targeting Xamarin.Forms and .NET MAUI
- With C# Markup, Global usings, and Compiler directives, both
Xamarin.Forms and .NET MAUI can be targeted from a single project
1.5.0.0:
- Project templates updated to support .NET MAUI RC3 with VS2022 Preview 17.3.0 Preview 1.0 or later
- .NET MAUI workload is now a prerequisite for installing this extension
1.4.1.0:
- Service release on top of v1.4.0.0
- CommunityToolkit.Maui and CommunityToolkit.Maui.Markup NuGet package versions bumped to v1.0.0-rc2
1.4.0.0:
- Project templates updated to support .NET MAUI RC2 with VS2022 Preview 17.2.0 Preview 5.0 or later
- .NET MAUI (Preview) workload is now a prerequisite for installing this extension
- The VS Code Workspace file included in the project is made hidden while working with Visual Studio
- Project templates updated to include Tizen platform artifacts
- Included an option to reference CommunityToolkit.Mvvm (aka Microsoft MVVM Toolkit) NuGet package while creating the project
- More details on this exciting MVVM Toolkit in this article
1.3.1.0:
- Service release on top of v1.3.0.0
- Added Theming support for .NET MAUI Blazor Hybrid App project
- Conditionally enabled the BlazorWebView Developer Tools for crafting a pixel-perfect UI
- Included a VS Code Workspace file with the project to work seamlessly across IDEs
1.3.0.0:
- Project templates updated to support .NET MAUI RC1 with VS2022 Preview 17.2.0 Preview 3.0 or later
- .NET MAUI (Preview) workload is now a prerequisite for installing this extension
- App theming support added to .NET MAUI Blazor Hybrid App project
- Style definition has been restructured to better scale-like for
Font , FontSize , Light , and Dark theme-specific property definitions
- For more details, refer to the Styles.xaml file in the Resources folder
1.2.0.0:
- Project templates updated to support .NET MAUI Preview 14 with VS2022 Preview 17.2.0 or later
- .NET MAUI (Preview) workload is now a prerequisite for installing this extension
1.1.1.0:
- To effectively support the BlazorWebView code snippet, including the .NET MAUI Blazor namespace itself as a code snippet with a shortcut titled
mb (stands for Maui Blazor)
- Also includes the WPF Blazor namespace as a code snippet (since everything is XAML) with a shortcut titled
wb
1.1.0.0:
- Introduced an All-in-One .NET MAUI App Project Template - For more details, take a look at this article
- Added Xaml code snippet for BlazorWebView with shortcut titled
bwv with xmlns prefix as b , in any of the Xaml files, type bwv and press the tab key to insert the snippet. Refer to Getting Started guide for a detailed list and their shortcuts
- Adding xml namespace (xmlns) implicitly is not yet supported for Xaml snippets, hence it's a manual action
- .NET MAUI (Preview) workload (VS2022 17.2 Preview 1.0 or higher) is now a prerequisite for installing this version of the extension
1.0.0.10:
- Project templates updated to support .NET MAUI Preview 12 with VS2022 Preview
- .NET MAUI (Preview) workload is now a prerequisite for installing this extension
- Added a XAML only Resource Dictionary item template as its code-behind is rarely used (a maintenance overhead)
1.0.0.9:
- Project templates updated to support .NET MAUI Preview 10 with VS2022 Preview
- .NET MAUI (Preview) workload is now a prerequisite for installing this extension
1.0.0.8:
- Project templates updated for .NET MAUI Preview 8 with Single Project for all supported Platforms
- .NET MAUI workload is now a prerequisite for installing this extension
1.0.0.7:
- Project Template for .NET MAUI App (C#)
- Usability improvements in the C# and XAML Code Snippets
1.0.0.6:
- C# and XAML Code Snippets (refer to Getting Started guide for a detailed list and their shortcuts)
1.0.0.5
- Project template for .NET MAUI Class Library
- Item template for Shell and Resource Dictionary, both in XAML
1.0.0.4
- Minor fix in BlazorApp template
1.0.0.3
- Templates updated to .NET 6 Preview 7
- Support for VS2022 Preview 3.0
- Removed the usage of IPage and IView interfaces from ContentPage and ContentView templates respectively
1.0.0.2
- Item templates for ContentView, in both XAML and C#
1.0.0.1
- Item templates are categorized into a separate folder titled MAUI for quick access
1.0.0.0
- Initial release of Templates
| |