File locking
I have a large C# 6.0 project using .NET 4.6. I am able to debug my main solution item -- my server application. But it locks the files so that I cannot debug any other solution items, such as my client application, while the server is running. This is not an issue in Visual Studio, where I am able to debug other solution items while debugging the main server application.
Microsoft.Common.CurrentVersion.targets(4187, 5): [MSB3027] Could not copy "obj\x64\Debug\EDC Library.dll" to "..\..\Debug\EDC Library.dll". Exceeded retry count of 10. Failed. The file is locked by: "JetBrains JetBrains.Debugger.Worker (37004), AIMS Server (28532)"
Microsoft.Common.CurrentVersion.targets(4187, 5): [MSB3021] Unable to copy file "obj\x64\Debug\EDC Library.dll" to "..\..\Debug\EDC Library.dll". The process cannot access the file '..\..\Debug\EDC Library.dll' because it is being used by another process.
Please sign in to leave a comment.
Hi Dan,
Could you clarify what happens if you build the entire solution (Build->Build Solution) before debugging the server or the client? In case your solution contains too many projects, please build both debug targets - the server and the client.
Hi Kirill Filin. The same error occurs when I build the entire solution before debugging. I also just discovered that if I try running the client application through Rider, it doesn't load and throws no errors.
Dan, could you send us Rider logs with additional tracing information? To collect the logs, please follow the steps described below:
You can send the logs via the Upload Service. Please let us know the Upload ID generated by the service.
Kirill Filin The upload id is for running my AIMS Admin app after running AIMS Server 2020_10_21_7UMPXQGy4aTgMobC
The upload id for running my AIMS Server app, stopping it, and running AIMS Admin is 2020_10_21_NEdBvVfYYUtXuhkH
The debugger says it can't find the assemblies -- but this is all working accordingly in Visual Studio Pro
Hello Dan,
Thank you for the logs. Would it be possible to send us the .csproject files of the Client and the Server as well?
2020_10_29_GbmVAAdLwQfEnrUY
2020_10_29_CdNx4PA4KiXiA6vf
Thank you for the project files Dan!
We're looking into the build events you are using, and it seems like we'll need one more .csproj - the one that belongs to EDC Library (DLLs\EDC Library\EDC Library.csproj). Would it be possible to send us this file?
2020_11_10_AoGZAKEZEjNjKu6v
Dan, we've looked into your project and, it seems that every time you build AIMS Server and AIMS Admin (and any other project that depends on EDC Library), MSBuild will attempt to copy the EDC Library DLL to the <OutputPath>. This is unnecessary because EDC Library will be copied to the output directory once the EDC Library project is built.
To avoid this, please add the <ReferenceOutputAssembly> metadata to the .csproj of the projects that reference this library. The <ProjectReference> of EDC Library will look like this:
Let us know if the debugging issue persists once you alter the ProjectReferences.
That change breaks all my projects, which will no longer build.
Hello Dan,
Thank you for the update. I'm sorry to hear that the ReferenceOutputAssembly change did not help. Could you temporarily add <ReferenceOutputAssembly>false</ReferenceOutputAssembly> to the projects, build the solution, and collect the Rider logs so that we could look into the build failure?
In the meantime, you can remove the "Build project" action executed before launch from all Run configurations and build the projects or the solution independently before debugging the projects with Rider. I realize that this approach is frustrating and inconvenient, but this is the only workaround we have at this time.