如何在Blazor中生成deps.json和runtimeconfig.json文件



我正在努力学习这里的Blazor教程。我对整个解决方案进行了dotnet还原,并能够成功运行BlazingPizza.Server项目,但当我尝试运行Blazing Pizza.Client使用dotnet watch运行时,我得到了以下错误:

watch : Started
Cannot use file stream for [/Users/user/projects/blazor/blazor-workshop/save-points/00-get-started/BlazingPizza.Client/bin/Debug/net5.0/BlazingPizza.Client.deps.json]: No such file or directory
A fatal error was encountered. The library 'libhostpolicy.dylib' required to execute the application was not found in '/Users/user/projects/blazor/blazor-workshop/save-points/00-get-started/BlazingPizza.Client/bin/Debug/net5.0/'.
Failed to run as a self-contained app.
- The application was run as a self-contained app because '/Users/user/projects/blazor/blazor-workshop/save-points/00-get-started/BlazingPizza.Client/bin/Debug/net5.0/BlazingPizza.Client.runtimeconfig.json' was not found.
- If this should be a framework-dependent app, add the '/Users/user/projects/blazor/blazor-workshop/save-points/00-get-started/BlazingPizza.Client/bin/Debug/net5.0/BlazingPizza.Client.runtimeconfig.json' file and specify the appropriate framework.
watch : Exited with error code 131
watch : Waiting for a file to change before restarting dotnet...

我下载了最新版本的.NET SDK(5.0.302(,根据错误消息,我似乎缺少了一些.NET特定的文件,但我不知道如何添加它们。我应该使用dotnet添加这些库特定的文件吗?只是感到困惑,因为教程中没有提到需要做点网恢复之外的任何事情

我从根本上误解了Blazor应用程序的运行方式。您不需要运行每个单独的部分(.server、.client(,只需运行服务器,它就会为客户端提供服务。

最新更新