Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run compiled blazor web client from command line?

Let's say I have classic blazor projects -- server, client, and shared. I can set server as startup project in VS 2019 and run it (it will run server). Or I can set client as a startup project and run it (it will run client). So far, so good.

I can switch to command line, navigate to "bin" folder of server and execute "dotnet WebBlazor.Server.dll", server will run as I expected it.

But when I navigate to client folder I can see dll is placed in two places -- next to "wwwroot" folder and inside "wwwroot/_framework" folder along with other dlls. When I try to execute "dotnet WebBlazor.Client.dll" (in both mentioned places) I got error stating there is no such file as WebBlazor.Client.deps.json. and also that 'hostpolicy.dll' library is missing.

Futher error message directs me into two choices that I should run web client as self-contained app or framework-dependent app. All I would like to do is to run client -- if I am not mistaken in server case Kestrel is run automatically and on top of tip the server code I write. I assumed this is the case also with the client, so I would like to run it in CLI as VS is able to run it.

I am not publishing my app yet, I just want to run compiled binaries from CLI.

like image 347
greenoldman Avatar asked Oct 12 '25 03:10

greenoldman


1 Answers

In your client project folder, launch :

dotnet run 
like image 98
agua from mars Avatar answered Oct 14 '25 18:10

agua from mars