Join me on Developer Thoughts, an exclusive blog for .NET MAUI and Blazor.
| Channel | NuGet | VS Marketplace |
|---|---|---|
| Stable |
To install the template NuGet package, use the below .NET CLI command:
Latest stable version:
dotnet new install VijayAnand.WinUITemplatesIf you've already installed this package, then it can be updated to the latest version with the below command:
dotnet new update --check-onlydotnet new updateTo provide an integrated experience, a VS extension has been developed to host these templates.
The VS extension is now supported on both x64 and ARM64 installations of Visual Studio 2022 and 2026 release. Happy coding!
Consequently, the minimum supported version of Visual Studio 2022 will be v17.6 or higher.
The v4.4 or higher extension is now compatible with the Visual Studio 2026 release v18.0.0
Extension is made available in the Visual Studio Marketplace and even more easier, can be installed from within Visual Studio itself (Extensions -> Manage Extensions / Alt + X + M).
| Item | Template Name | Type |
|---|---|---|
| WinUI 3 App | winui | Project |
| WinUI 3 Blazor App | winui-blazor | Project |
| WinUI 3 Class Library | winuilib | Project |
| WinUI 3 Page | winui-page | Item |
| WinUI 3 UserControl | winui-usercontrol | Item |
| WinUI 3 Window | winui-window | Item |
All three project templates takes the target framework as an input parameter, can be specified with --framework / -f.
And the supported values are:
- net8.0
- net9.0
- net10.0 (the default value)
Note: The default value for the framework parameter remains as net10.0 (the latest stable release), which means to create a project for .NET 8 or .NET 9, an explicit value of net8.0 / net9.0 is to be passed.
All three project templates take the below optional parameter to include the officially supported CommunityToolkit.Mvvm NuGet package.
-imt|--include-mvvm-toolkit- Default value isfalse
Both the App project takes another optional parameter thus allowing it to be created as MVVM supported solution using the same Microsoft MVVM Toolkit.
-mvvm|--use-mvvm- Default value isfalse
Starting with v3.1.0, all three project templates take the below optional parameter support NuGet's Central Package Management (CPM) feature.
-cpm|--central-pkg-mgmt- Default value isfalse
Starting with v3.3.0, added the ability to use the NuGet Central Package Management (CPM) feature within Visual Studio IDE.
Starting with v3.4.0, introduced an option to support the XML-based solution file (slnx) format.
-slnx|--use-slnx- Default value istrue(fromv5.0onwards)
Starting with v4.0.0, added another option (net10.0) to the framework parameter to support .NET 10 Previews and revamped the WinUI Blazor project template.
Starting with v4.2.0, introduced an option to abstract the Shared components as a separate .NET MAUI and/or Razor Class Library.
.NET MAUI XAML can be included within this .NET MAUI-specific class library.
-mcl|--maui-class-library- Default value isfalse
This Razor Class Library allows code reuse with other projects such as ASP.NET Core.
-rcl|--razor-class-library- Default value isfalse
Note: Use both options to segregate MAUI and Razor components into distinct libraries.
dotnet new winui-blazor -o MyApp -mcldotnet new winui-blazor -o SharedApp -rcldotnet new winui-blazor -o HybridApp -mcl -rclStarting with v4.3.0, introduced an option to use Nightly builds with WinUI Blazor projects for .NET MAUI components, featuring automatic configuration of package feeds.
Nightly Builds support:
dotnet new winui-blazor -o NightlyApp -niNote: These options may also be combined.
Use the below .NET CLI command to create the projects out these template:
dotnet new winui -n MyApp.NET 9:
dotnet new winui -n MyApp -f net9.0.NET 8:
dotnet new winui -n MyApp -f net8.0MVVM based solution:
dotnet new winui -n MyApp -mvvmOption to include only the MVVM NuGet package:
dotnet new winui -n MyApp -imtOption to use the CPM feature:
dotnet new winui -n MyApp -cpmOption to create the classic SLN solution file:
dotnet new winui -n MyApp -slnx:falsedotnet new winui-blazor -n HybridApp.NET 9:
dotnet new winui-blazor -n HybridApp -f net9.0.NET 8:
dotnet new winui-blazor -n HybridApp -f net8.0MVVM based solution:
dotnet new winui-blazor -n HybridApp -mvvmOption to include only the MVVM NuGet package:
dotnet new winui-blazor -n HybridApp -imtOption to use the CPM feature:
dotnet new winui-blazor -n HybridApp -cpmOption to create the classic SLN solution file:
dotnet new winui-blazor -n HybridApp -slnx:falsedotnet new winuilib -n MyLib.NET 9:
dotnet new winuilib -n MyLib -f net9.0.NET 8:
dotnet new winuilib -n MyLib -f net8.0Option to include only the MVVM NuGet package:
dotnet new winuilib -n MyLib -imtOption to use the CPM feature:
dotnet new winuilib -n MyLib -cpmOption to create the SLNX solution file:
dotnet new winuilib -n MyLib -slnxUse the below .NET CLI command to create the items out these template:
All these item templates require one mandatory parameter:
-n|--name- Name of the item
Auto suffixing of the Type name is supported for the files created with the Page and Window item templates.
Page:
dotnet new winui-page -n OrderUserControl:
dotnet new winui-usercontrol -n CardViewWindow:
dotnet new winui-window -n Home