Now targeting .NET 6, moving forward package versions will reflext the .NET version
CleanBlazor is listed in Microsoft's official dotnet Github repository under the Available templates for dotnet new section.
CleanBlazor is also Available on Nuget
CleanBlazor by default generates projects that target the latest .NET version.
The out of the box Microsoft Blazor project templates are great for getting familiar with Blazor or creating PoC apps.
However, for brand new custom Blazor projects we will usually want to remove some of the boilerplate assets (e.g. Bootstrap, the Counter component, etc.).
The CleanBlazor project templates save you some time by providing minimal Blazor server and wasm templates (dotnet CLI and Visual Studio). Use to start out of the box Microsoft Blazor projects minus any boilerplate and unnecessary html/css/js/razor.
- Make sure you have the latest version of the .NET SDK installed.
- Open a terminal (e.g. powershell or bash) in any directory.
- Install the dotnet templates.
dotnet new --install FriscoVInc.DotNet.Templates.CleanBlazor
dotnet new --list
Open a terminal in any directory and run the dotnet new
command.
Example:
dotnet new cleanblazorserver --output c:/source/MyBlazorServerApp
cd MyBlazorServerApp
dotnet run
dotnet new cleanblazorserver --help
dotnet new cleanblazorwasm --help
- Open Visual Studio 2022.
- Open the New Project Dialog. CTRL+SHIFT+N.
- Search for Clean Blazor. Alt+S, then type 'Clean Blazor'.
- Select the Clean Blazor Server or Clean Blazor Wasm project type.
- Name project and solution.
- Create project
- Done!
*General Tip: always make sure you're IDE is up to date. Easiest is to update via the Visual Studio installer.
These project templates target .NET 6 onwards.
Every time a new .NET version comes out, the project templates will be updated accordingly to match the newest version of .NET.
Checkout the nuget page for different versions of these templates if by any chance you want/need to target a specific .NET version.
- Use Visual Studio 2022 and keep it updated.
- If not using an IDE, make sure you have the latest version of .NET
- Keep your project templates updated. Simply run:
dotnet new --update-apply
dotnet new --uninstall FriscoVInc.DotNet.Templates.CleanBlazor
Or if you want to uninstall a specific version:
dotnet new --uninstall
You now get a list of commands to uninstall any custom templates on your PC. Copy the command you want and run it.
- [Github] DotNet templating wiki
- [Github] Available templates for dotnet new
- [Microsoft] Custom templates for dotnet new
- [Microsoft] Tutorial: Create an item template
- [Microsoft] .NET CLI Templates in Visual Studio