blazorblazor-webassembly.net-8.0

How to make my blazor webassembly project run from file folder (by double clicking to open it)


I've created a blazor webassembly project, it can run from VS, but after I published it to my local folder, for the index.html, can I run it by double clicking it?

Do I have to use a web server?

Can I embed everything (like .css .js .wasm) into the .html file?

I have an error like this:

enter image description here


Solution

  • Do I have to use a web server?

    Yes

    An example: install dotnet-serve

    dotnet tool install --global dotnet-serve
    

    start the server

    dotnet serve -o -S
    

    result: enter image description here