Skip to content

Minimal Blazor server and wasm templates (CLI and Visual Studio). Out of the box Microsoft templates minus the boilerplate html/css/js/razor

License

Notifications You must be signed in to change notification settings

fvilches17/CleanBlazor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Now targeting .NET 6, moving forward package versions will reflext the .NET version

CleanBlazor

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.

Problem

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.).

Solution ⏱

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.

Getting Started 🚀

  1. Make sure you have the latest version of the .NET SDK installed.
  2. Open a terminal (e.g. powershell or bash) in any directory.
  3. Install the dotnet templates.
dotnet new --install FriscoVInc.DotNet.Templates.CleanBlazor

successfull install

dotnet new --list

listing dotnet templates

Create a project (CLI)

Open a terminal in any directory and run the dotnet new command. Example:

dotnet new cleanblazorserver --output c:/source/MyBlazorServerApp
cd MyBlazorServerApp
dotnet run

app running on browser

Additional CLI Options

dotnet new cleanblazorserver --help
dotnet new cleanblazorwasm --help

Create a project (Visual Studio 2022)

  1. Open Visual Studio 2022.
  2. Open the New Project Dialog. CTRL+SHIFT+N.
  3. Search for Clean Blazor. Alt+S, then type 'Clean Blazor'.
  4. Select the Clean Blazor Server or Clean Blazor Wasm project type.
  5. Name project and solution.
  6. Create project
  7. Done!

vs New Project dialog

*General Tip: always make sure you're IDE is up to date. Easiest is to update via the Visual Studio installer.

Gotcha's 😬

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.

Tips 💪

  • 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

How to uninstall the Clean Blazor project templates

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.

Additional Resources 📚

About

Minimal Blazor server and wasm templates (CLI and Visual Studio). Out of the box Microsoft templates minus the boilerplate html/css/js/razor

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published