cba*_*ara 5 c# asp.net blazor blazor-webassembly
我已经使用 Visual Studio Code 和 .NET 3.1.1 设置了 Blazor WebAssembly 应用程序。它有一个 ASP.NET Core 主机。我试图同时使用自动更新服务器和客户端上的代码,dotnet watch run
但我无法这样做。我尝试打开两个单独的命令行并在客户端和服务器上运行该命令,但它一次只允许我运行一个。我还尝试将以下代码添加到我的 Server .csproj 文件中:
<ItemGroup>
<Watch Include="..\Client\**\*.razor" />
</ItemGroup>
Run Code Online (Sandbox Code Playgroud)
但是当我dotnet watch run
在命令行中的服务器文件夹中运行并进行任何更改时,我收到此错误:
C:\Program Files\dotnet\sdk\3.1.403\Microsoft.Common.CurrentVersion.targets(4187,5): warning MSB3026: Could not copy "obj\Debug\netcoreapp3.1\BlazorBattles.Server.dll" to "bin\Debug\netcoreapp3.1\BlazorBattles.Server.dll". Beginning retry 1 in 1000ms. The process cannot access the file 'C:\Users\dbandara\Development\dotnet\Tutorials\BlazorBattles\BlazorBattles\Server\bin\Debug\netcoreapp3.1\BlazorBattles.Server.dll' because it is being used by another process. [C:\Users\dbandara\Development\dotnet\Tutorials\BlazorBattles\BlazorBattles\Server\BlazorBattles.Server.csproj]
Run Code Online (Sandbox Code Playgroud)
此外,当我对服务器项目进行任何更改时,除非我重新运行该程序,否则它不会更新。它将识别对 Client 文件夹的更改,但会引发上述错误。
如果我dotnet watch run
在客户端文件夹上运行它工作正常。
关于如何在客户端和服务器上同时成功运行 dotnet watch run 而不会出现此错误的任何建议?
归档时间: |
|
查看次数: |
2931 次 |
最近记录: |