Closed jonas-johansson closed 8 months ago
I'm getting the issue, but I see that I occasionally get it on the first build as well. Not sure what's causing it.
Did you mean to close this issue?
Are you able to tell which part of the build process is producing the error message? I'm mainly wondering if it's coming from the NuGet tasks or the main MSBuild tasks. The NuGet tasks are kind of their own little system so if the error is happening during restore that might suggest a whole separate set of problems from the build tasks.
Another thing to try is generating a binlog file and then opening it in the Structured Log Viewer. That should tell us exactly which build task is producing the error message.
You can turn on binary logging in your ProjectAnalyzer
like this:
analyzer.AddBinaryLogger(@"C:\SomePath\log.binlog");
Hey @daveaglick!
Yeah, I closed the issue because I felt that I had framed it incorrectly. I opened it up now, and added more information below:
As I mentioned, I'm getting The process cannot access the file 'X' because it is being used by another process.
The file in question is always SomeRandomProject\obj\SomeRandomProject.csproj.nuget.dgspec.json
.
Sometimes the build passes, but often it's one of the most low-level projects with a high number of projects referencing it.
I'm going to try out the binlog!
Thanks for the binlog tip @daveaglick!
Here's what I can see in one of the cases I reproduced:
Utils
project.Persisting no-op dg to XXX\Utils\obj\Utils.csproj.nuget.dgspec.json
C:\Program Files\dotnet\sdk\3.1.201\NuGet.targets(124,5): The process cannot access the file 'XXX\Utils\obj\Utils.csproj.nuget.dgspec.json' because it is being used by another process. [XXX\ClientProject\ClientProject.csproj]
I previously explored the following NuGet.Client issue because of the error message I received: https://github.com/NuGet/NuGet.Client/pull/3170. I updated Visual Studio (and I assume NuGet is part of that process) but I still get the issue.
Any ideas?
Hello @jonas-johansson, after new versions do you still have this problem?
Hello @jonas-johansson, after new versions do you still have this problem?
I'm not using Buildalyzer right now so unfortunately I can't comment on that.
Thanks for the feedback, I'll close the issue, if anyone has the same problem, please open a new issue.
When doing two consecutive builds I get the following errors on the second build.
It is repeated for a number of files.
If I add a long pause between the builds it builds successfully.
It appears as if Buildalyzer doesn't wait for some process to finish.