Creating a Custom Blazor WebAssembly Project Template

Learn how to create a custom Blazor WebAssembly template.

As we have seen, the Demo Blazor WebAssembly project created by the Blazor WebAssembly App project template includes quite a few files. In later chapters, we will want to start with an empty Blazor project. So, we will create our own project template that creates an empty Blazor WebAssembly project.

Creating an empty Blazor project

We need to create an empty Blazor WebAssembly project to base our new project template on. We do this as follows:

  1. Return to Visual Studio.
  2. Delete the wwwroot\sample-data folder.
  3. Delete all of the components in the Pages folder, except for the Index component.
  4. Open the Index.razor file.
  5. Delete all of the markup from the Index component. Make sure that you do not delete the @page directive at the top of the page.
  6. Delete the Shared\SurveyPrompt.razor file.
  7. Open the Shared\MainLayout.razor file.
  8. Remove the “About” link from the top row of the layout by removing the following markup:

Get hands-on with 1400+ tech skills courses.