.NET MAUI Project Templates, Item Templates, and Code Snippets for Visual Studio 2022
It is recognized as one of the Top Free Extensions for Visual Studio 2022 by Visual Studio Magazine, a renowned 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 (supported on both x64 and ARM64 installations).
This VS extension does not gather any usage or telemetry data, even anonymously, ensuring you can use it with complete privacy assurance.
This has Project Templates for:
- .NET MAUI App - An All-in-One App Project Template - For more details, take a look here
- .NET MAUI Class Library
- Shared Class Library (Xamarin.Forms and .NET MAUI)
And Item Templates for:
- Generic Item
- Generic Item (C#)
- 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 8 and 9 GA, Service Releases, Previews, if any, and Nightly Builds (starting with VS2022 17.6.0 or higher (including Previews)). To accommodate future updates in newer .NET MAUI releases, an update for this VS extension will be made available as needed. If you encounter any issues or have suggestions for improving these templates, please log them as issues here.
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.6.0 or a later version).
6.1.0.0:
- Introduced an option to create a new project template using HybridWebView.
- To know more about this new control, consult this Exploring HybridWebView article.
- To facilitate this, within the
Project Options page in the IDE, the Application Design option is available as a dropdown UI control. Select JSHybrid as its value.
- Since HybridWebView is a feature introduced in .NET MAUI 9, creating a .NET MAUI 8 App with this value of
JSHybrid will NOT result in an error; instead, it will fall back by creating an App project that corresponds to the default Plain value.
- The
Application Design option with the value Hybrid will continue to generate an App project using BlazorWebView , which works on both .NET MAUI 8 and 9, the present stable release.
6.0.1.0:
- Templates updated to support .NET MAUI 9 Stable channel release.
- The default value for the Framework parameter is now set to
.NET 9 (STS) .
- To create a .NET MAUI 8 project, explicitly select the
Framework parameter value as .NET 8 (LTS) .
- Added support for Dynamic NuGet package versioning for .NET MAUI 9 (similar to that in .NET MAUI 8).
- Removed unsupported versions (.NET MAUI 6 and 7) and Comet, as it is no longer being updated.
- For ease of use, the MAUI CommunityToolkit and Syncfusion MAUI Toolkit's XAML namespaces have been added to the App.xaml file, if opted.
- Support for Nightly build configuration has been added for .NET MAUI 9 also.
- Wherever applicable, .NET MAUI 9 constructs are applied, such as referencing the
Window's Page instead of the Application's MainPage .
5.16.0.0:
- Introduced the option to add and configure the Syncfusion.Maui.Toolkit NuGet package.
- Note: This would be an explicit option.
5.15.0.0:
- Templates updated for .NET MAUI 9 RC2.
5.14.0.0:
- Templates updated for .NET MAUI 9 RC1.
- The
WindowsSdkPackageVersion property has been temporarily included to use the latest version of the MVVM toolkit.
- Additional metadata for base types in the Generic item template.
5.13.1.0:
- Android targetSdkVersion bumped to v35 for App projects targeting .NET MAUI 9.
5.13.0.0:
- Templates updated for .NET MAUI 9 Preview 7.
5.12.0.0:
- The All-in-One .NET MAUI Templates Pack VS extension is now supported on both x64 and ARM64 installations of Visual Studio 2022. Happy coding!
- Consequently, the minimum supported version of Visual Studio 2022 will be v17.6 or higher.
5.11.0.0:
- Introduced an option to support the XML-based solution file (
slnx ) format.
- This would be an explicit option since the
slnx feature is currently in the preview stage and is only supported on VS2022.
5.10.0.0:
- The reference to the
Microsoft.Maui.Controls.Compatibility NuGet package has been removed from the .NET 9 project templates.
- Reliability improvements.
5.9.0.0:
- Templates updated for .NET MAUI 9 Preview 6 and .NET MAUI 8 SR7 release
5.8.0.0:
- Introduced the option to add and configure the CommunityToolkit.Maui.Camera package in both the MAUI App and Class Library project templates
5.7.0.0:
- Introduced an option to add the Maps package in both MAUI and Shared Class Library project templates
- Added Apple's Privacy Manifest file to facilitate submitting the macOS app (MacCatalyst) to the App Store
- Little housekeeping to make the templates even more reliable
5.6.2.0:
- Templates have been updated to support the .NET MAUI 8 Service Release 6 (v8.0.60)
- When not utilizing the NuGet CPM feature, define the
MauiVersion property value as a floating version
- This applies solely to the .NET 8 Stable channel
5.6.0.0:
- Introduced using the NuGet CPM feature from within Visual Studio IDE
- Automated the process of using MAUI Nightly builds without any need for manual configuration with a local
NuGet.config file
- Opt-in for the Nightly build, and you're all set
- While abstracting the Shared components, the
Directory.Packages.props file would get listed as a solution item to update the MauiVersion property, if necessary
- Templates have been updated to support the .NET MAUI 9 Preview 5
5.5.0.0:
- Introduced an option to abstract the Shared components as a separate .NET MAUI Class Library
- This will create a solution structure that is akin to Xamarin.Forms (the only difference is that there won't be multiple head projects)
5.4.0.0:
- Templates updated to support .NET MAUI 9 Preview 4 release (9.0.0-preview.4.10690)
- Added Apple's Privacy Manifest file to facilitate submitting iOS App to the App Store
5.3.0.0:
- Templates updated to support the latest .NET MAUI 8 service release (SR5 - 8.0.40)
5.2.1.0:
- Templates updated for the latest .NET MAUI release
- The
.NET MAUI Community Toolkit package version bumped to reference the latest release
5.1.0.0:
- Templates updated for the latest .NET MAUI release
- The MauiVersion property is updated to dynamically refer to the latest available service release (
8.* )
- Auto inclusion of
.NET MAUI Community Toolkit 's xml namespace while using NET MAUI Generic item template with its type name defined with scope as mct:
5.0.0.1:
- Support for creating
.NET MAUI projects on .NET 9 Previews
- On the stable channel, the value of the MauiVersion property is bumped to 8.0.7 to support the latest version of
.NET MAUI 8 SR2 NuGet packages
- For more details, check this article
4.9.0.0:
- A revolutionary generic item template, in XAML and C#, for creating items of any type
- Both need one required parameter, the Base type
- And optionally takes another parameter, to specify the Generic base type
- In addition, the XAML template takes one more parameter (Xaml Only), to generate only the XAML definition
- Frequently used base types are loaded in the Editable dropdown, user can also enter their value here
- Ensure the values are entered in Pascal notation. XAML templates support XML namespace prefix, quite like how it is used in the real world (
mct:Popup )
- The one big advantage of using this on IDE is the relative namespace to the folder where the item is created whereas on CLI, this defaults to the root namespace
- Note: Namespace resolution in both XAML and C# files is left to the user as deriving them with the template is outside its scope.
- Tip: For the XAML template, pass the
xmlns scope as part of the input parameter value and it'll be used appropriately in the generated source files
- Tip: Use
local scope to refer to the types in the same directory like Views . For example, local:BasePage
4.8.1.0:
- Defined MauiVersion property (with its value set to
8.0.6 ) in the .NET 8 stable template to support .NET MAUI 8 SR1
- For more details, check this article
4.7.0.0:
- Xamarin.Forms Target Framework option in Shared Class Library project template
- Supported values are:
.NET Standard 2.0 (default value) and .NET Standard 2.1
- And for .NET MAUI via the Framework option
- Supported values are:
.NET 8 (default value), .NET 7 , and .NET 6
4.6.0.0:
- Added the option to reference Nightly build MAUI packages (from the CI feed) in all the supported templates.
Note: For this work, add the following URL as a NuGet package source and more details here:
dotnet nuget add source -n maui-nightly https://aka.ms/maui-nightly/index.json
4.5.0.0:
- MAUI Community Toolkit package versions bumped to their latest versions supporting the .NET 8 release
- Option to reference the Shared Toolkit NuGet package in all of the templates
4.4.0.0:
- Templates updated for .NET 8 RTM
- Incorporated .NET 8 / C# 12 features wherever possible
- .NET MAUI Version on the Main page of the App
4.3.6.0:
- Defined custom logic for BlazorWebView XAML item template processing
4.3.0.0:
- Templates updated for .NET 8 RC2
4.2.2.0:
4.2.1.0:
- Support for Blazor Hybrid in F# project template. Added the
Application Design parameter for this.
- This takes two options, Plain and Hybrid. The default value is Plain.
Note: The RCL project in the F# template is C# based as Razor compilation is not working with F# as expected.
- Option to include reference Shared Toolkit while creating the Shared Class Library project.
- .NET MAUI Community Toolkit package versions bumped to their latest versions.
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
| |