Skip to content
| Marketplace
Sign in
Visual Studio>Tools>Blazor GitHub Pages SPA
Blazor GitHub Pages SPA

Blazor GitHub Pages SPA

pierre3

|
652 installs
| (0) | Free
Blazor WebAssembly template for hosting on GitHub Pages.
Download

Blazor WASM GitHub Pages Template

A Blazor WebAssembly template for hosting on GitHub Pages.

This template works in the following environment.

  • Visual Studio 2019 (Version 16.6 or later)
  • .NET Core 3.1 SDK

Over View

This is a project template that adds the following changes to the official Blazor WebAssembly template.

  • Add the scripts needed to run a single-page application on a static site based on the methodology described in here

    • Add a custom 404.html page that rewrites the URL and redirects it to index.html
    • Add a script to index.html to handle routing
  • Change the path base to the path to the GitHub project page

    • <base href="/my-repository-name/" />
  • Added GitHub action to build pushed source code in Master branch and deploy it to gh-pages branch

Installation

Download the VSIX installer from the Visual Studio Marketplace or use the Manage extensions dialog box in Visual Studio to install it.

  • Blazor GitHub Pages SPA - Visual Studio Marketplace

  • Find and install extensions - Visual Studio

Usage

  1. Launch the Visual Studio 2019 and select "Create a New Project".

  2. Select "Blazor GitHub Pages SPA" from the list of projects and click on the "Next" button.

readme001.PNG

  1. "Configure your new project" dialog, enter "project name" and "solution name" and click the "Create" button.
    • In the solution name, enter the name of the repository you want to create on GitHub.

readme002.PNG

  1. Once the project you created is loaded, select "Add to Source Control" from the "File" menu.

readme003.PNG

  1. In the "Initialize Git repository" dialog, select "GitHub" and enter "Solution Name" in the "Repository Name" field.

readme004.PNG

  1. When you click the "Initialize and Push" button, a repository is created on GitHub and the source code is pushed to the Master branch.

readme005.PNG

  1. When you push your code to the master branch, GitHub Actions executes the build and pushes the build artifact to the "gh-pages" branch.

readme006.PNG

  1. On your GitHub repository page, click on the Settings tab and check the GitHub Page section.

  2. After selecting "master branch" in the "Source" field pull-down, select "gh-pages branch" again.

readme007.PNG

  1. When you see "Your site is published at {URL}", click on the URL. This should take you to the Blazor Webassembly site you just created. (It will take a little while for the page to become accessible.)

readme008.PNG

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft