0

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?

2
  • Do you want a static html site, or a server less WASM site? Commented Feb 22 at 19:37
  • Actually both could do. Now I've managed to do it using serverless WASM. But because the website will be mostly static, an optimalization could be to make it a static HTML site. Commented Feb 23 at 10:02

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

0

I found out I didn't have a good understanding of BlazorWASM. The BlazorWASM template of the dotnet tool allows "publishing". This process results in an output with only web files (.HTML, .CSS, .JS, .WASM and browser .DLLs). I can run it in my browser without starting .NET.

This is the procedure I used:

  1. Execute command dotnet new blazorwasm -n my-project
  2. Write code
  3. Execute command dotnet publish --configuration RELEASE
  4. Open folder bin/Release/net7.0/publish/wwwroot
  5. Publish to GitHub by adding the contents to a git repo and push it to the GitHub remote repo.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.