如何从命令行运行已编译的blazor Web客户端? [英] How to run compiled blazor web client from command line?

查看:74
本文介绍了如何从命令行运行已编译的blazor Web客户端?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

比方说,我有经典的blazor项目-服务器,客户端和共享项目.我可以在VS 2019中将服务器设置为启动项目并运行它(它将运行服务器).或者,我可以将客户端设置为启动项目并运行它(它将运行客户端).到目前为止,一切都很好.

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.

我可以切换到命令行,导航到"bin"服务器文件夹并执行"dotnet WebBlazor.Server.dll",服务器将按预期运行.

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.

但是,当我导航到客户端文件夹时,我可以看到dll被放置在两个位置上,即"wwwroot"旁边.文件夹和"wwwroot/_framework"内部文件夹以及其他dll.当我尝试执行"dotnet WebBlazor.Client.dll"时,(在两个提到的地方)我都出现错误,指出没有WebBlazor.Client.deps.json这样的文件.而且缺少"hostpolicy.dll"库.

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.

错误消息将我带入两个选择,我应该将Web客户端作为独立应用程序或与框架相关的应用程序运行.我要做的就是运行客户端-如果在服务器情况下没有记错的话,Kestrel会自动运行,并且最重要的是我编写的服务器代码.我以为客户端也是这种情况,所以我想在CLI中运行它,因为VS能够运行它.

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.

我尚未发布我的应用,我只想从CLI运行已编译的二进制文件.

推荐答案

在客户端项目文件夹中,启动:

In your client project folder, launch :

dotnet run 

这篇关于如何从命令行运行已编译的blazor Web客户端?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆