A Visual Studio 2019 template that creates a minimal Blazor Server project with a lot of the example code removed. This includes, but is not limited to removal of the following default artefacts:
- Counter page
- Weather forecast service and page
- Bootstrap
- Ionic
- Most of the mark-up in
MainLayout.razor
andIndex.razor
- Navigation
- Most of the default
site.css
Some fundamental features are left intact such as the default error pages, a basic layout and a minimal site.css
as well as the typical startup.cs
functionality. What you are left with is a clean, minimal Blazor server project which you can use as a starting point to build your preferred functionality.
- Install the BlazorServerMinimal.vsix file.
- Open Visual Studio 2019
- Create a new project
- Search for "Blazor"
- Choose "Blazor Server Minimal"
- Set the project name, location etc and create the project as usual
- Visual Studio does not replace the namespace correctly in
_Imports.razor
which prevents the application from building, presumably because this is a mark-up file rather than compiled code. To correct this, just replaceBlazorServerMinimalTemplate
with your own namespace manually in_Imports.razor
.
This repository has three projects:
- BlazorServerMinimalTemplate: This is the template that the VSIX is created from; a minimal Blazor Server project template.
- BlazorServerDefaultTemplate_v3-1-6: This is the default Blazor Server template with the counter, weather forecast, style and other items. This s based on v3.1.6 of the official default template.
- BlazorServerMinimal: This is the Visual Studio project template that is used to create the VSIX.
If you wish to create your own variation of this template and update the VSIX file, you can follow these steps
- Create your template project and export it: https://docs.microsoft.com/en-us/visualstudio/ide/how-to-create-project-templates?view=vs-2019
- Create a VSIX project which uses the ZIP created in step 1: https://docs.microsoft.com/en-us/visualstudio/extensibility/getting-started-with-the-vsix-project-template?view=vs-2019