Search code examples
blazorgithub-pages.net-5blazor-webassembly

How do I deploy Blazor WebAssembly .Net 5 standalone to GitHub page?


I've seen and attempted to follow several examples of how to do this, but they all seem to be for the version of web assembly projects that target .Net 2.1 Standard.

The project I am attempting to deploy with a github action is targeting .Net 5.0

According to the documentation from MS, "Standalone deployment assets are published into the /bin/Release/{TARGET FRAMEWORK}/publish/wwwroot folder."

https://learn.microsoft.com/en-us/aspnet/core/blazor/host-and-deploy/webassembly?view=aspnetcore-5.0#standalone-deployment

I'd thought of just giving up on a CI/CD for this and just deploying it manually. However, when I examine this folder, there is no 'publish' folder inside the {TARGET FRAMEWORK} folder. And inside wwwroot, there is nothing resembling what I'd think of as a web site.

So... can anybody give direction on how to achieve this?


Solution

  • I think you should run the dotnet publish command to create the standalone deployment assets. You can run the publish command from visual studio by right clicking on the project --> Publish --> and creating a folder publish profile. By default the artifacts are placed at /bin/Release/net5.0/browser-wasm/publish/wwwroot if you aare using .NET 5.0