====== Deploy Blazor WebAssembly to GitHub Pages ======
Create a Blazor webassembly project, e.g.:
dotnet new blazorwasm -o BlazorWasmTest
Publish:
dotnet publish -c Release -o output
The base tag in output/wwwroot/index.html needs to be updated. Change this tag:
To this:
For example, if your GitHub username is ''johndoe'', and your repo name is ''my-cool-repo'', then your GitHub page URL tag will be this:
If you want to simplify this, e.g., in a Makefile, use these commands in a Makefile target:
dotnet publish -c Release -o output
cd output/wwwroot; sed -i 's|||' index.html
In the repo, enable GitHub pages and add a Static HTML GitHub action as the deployment method. Update the static.yml file for the action as follows: In jobs, deploy, steps, with, path, change ''path: '.''' to ''path: 'output/wwwroot'''.
When you commit, the contents of output/wwwroot will automatically be deployed.
{{tag>dotnet}}