4

I have setup a Blazor WebAssembly application using Visual Studio Code and .NET 3.1.1. It has an ASP.NET Core host. I am attempting to automatically update code on both the server and the client at the same time using dotnet watch run but I am unable to do so. I have tried opening two separate command lines and running the command on both the client and server but it only allows me to run on one at a time. I have also attempted to add the following code to my Server .csproj file:

<ItemGroup>
    <Watch Include="..\Client\**\*.razor" />
</ItemGroup>

but when I run dotnet watch run in the server folder in command line and make any changes, I get this error:

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]

Also when I make any changes to the server project it does not update unless I re-run the program. It will recognize changes to the Client folder but throws that error above.

If I run dotnet watch run on the Client folder it works fine.

Any recommendations on how to successfully run dotnet watch run on both client and server at the same time without getting this error?

cbandara
  • 81
  • 2
  • 10

0 Answers0