blazorstatic-site

Use Blazor for generating static serverless website (without .NET server)


I want to create a website and I appreciate the framework Blazor. Usually Blazor is used in .NET with server-side .NET. I would like to build a website that I can host using Github Pages.

Therefore I would like to be able to compile the C# and Razor code in a bundle of web files: HTML, JS, WASM and CSS. I understand I'm limited to only client-side Blazor. Routing can be a nice feature, but a single page (and URL) is also an option.

Is this possible? How do I get started with my project? And how do I go from there?


Solution

  • Yes, that is possible.

    You start with a "Blazor WebAssembly standalone" project and then push it to a Github repository. Very easy with the "Git changes" tab in VS.

    I think that you can only use the free Github Pages for a public repository.

    Then you need to set up a pipeline (Github action), there are many walkthroughs available on the net.