-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GenerateDepsFile: The process cannot access the file '...\MyProject.deps.json' because it is being used by another process. #2902
Comments
While trying to reproduce a failure on Windows with Procmon, I'm met with this. I've noticed sporadic errors like this before, but never enough of them to make an impression. Given the above, I think there might be a lot of concurrency issues in msbuild/dotnet build .. Other locking/access errors I've seen:
The process cannot access the file '...\Shared02.dll' because it is being used by another process.
Log
Could not read state file "obj\..\TopLib01.csprojAssemblyReference.cache". The process cannot access the file '..\TopLib01.csprojAssemblyReference.cache' because it is being used by another process.
Log
|
I have the same problem. Any solutions? |
The core problem here is that you're specifying a TargetFramework at the solution level. As you note, it works without that, while building all of the TargetFrameworks specified at the individual project level. We hope to improve the experience around this -- at least providing an informative error, but maybe also doing something smarter. But at the moment, I'm not quite sure what that would be. Can you describe why you're specifying a TargetFramework and what you expect to happen in that build, as distinct from the no-TF-specified solution build? |
For our current use case, we wanted to optimize our builds a bit, because we're targeting two frameworks to allow our developers to test the modules they're working (they have a small program.cs, and a shared library to actually run code -- only available to them when in netcoreapp2.x). So our builds on the CI would be building for both coreapp and netstandard. Targeting just netstandard (since everything in the slution supports that anyways) did this and shaved a few seconds of our builds. We've workarounded by not targeting the specific framework, since we found that it was just a few seconds.. However. I'm not at all sure why this is an issue.. All of the projects in question target netstandard2.0.. |
Hi, I've a case where there is no specifying of TargetFramework at the solution level where the This behavior has just emerged without any notice in In my case, there seems to be a race condition from my hardware setup, due to the Thank you. Regards |
Note that the spawned processes could be the Dotnet Build Server. You can try shutting them down by running |
Two out of three of them shut down with the
|
That does seem like one of the build processes from the parallel build (the |
Ok. Problem solved by provisioning a new virtual machine. |
We've run into another similar (but not the exact same) race condition:
I'm not sure if this is caused by a bug in the build system or if there is somehow a conflict in our projects that could be resolved by fixing the project definition. We use standard project layouts with simple SDK style csproj projects. In the latter case, it would be amazing if the build system could detect the sources of these conflicts and warn or error on them. |
I am getting this error if I simply call |
Currently I am thinking about workaround to simply change build script part from something like
To something like
There can be more tries if needed. |
@victor-yarema Can you please file a new issue for that? Please tag me. Because you're not specifying global properties at the solution level, you're seeing a different problem. If you can attach a binary log of your build (a successful build log is fine), hopefully we can figure out what's going on. Please read the warnings about the information contained in the log. If you cannot upload such a log, please file the bug anyway. I can suggest additional debugging techniques. |
….1 (#2902) - Microsoft.DotNet.Cli.Runtime - 5.0.100-alpha1.19465.1
FWIW, I've experienced similar issue with |
|
Encountered this build-error on a project of ours. We build our .Net Core solutions using a FAKE-script and that script failed while building a solution. A manual build of the solution with Turns out FAKE's FAKE.DotNet.MSBuild module adds the parameter From the build-log we see the
From the documentation of MSBuild about when no default value of
Which explains our issue of getting errors when building via FAKE but not via manual Our fix was to add |
I was bugged by this problem for a while. Took ages to spot the cause and resulted in having to build things twice if it failed. It turned out that one projects that referenced the project that always reported the error only had TargetFramework netstandard2.0, whilst all the others were both net5.0 & netstandard2.0. Once I switched that project to |
I'm currently facing this issue with the latest net6.0 sdk in the following build scenario:
The error occurs (on the first netstandard-only project) in ~30% of all builds. |
I've started facing this issue on CI (TeamCity) after introducing Source Generators to my project.
The workaround for me was to add
So clearly there is some race condition with file access. |
We are only using the project (.csproj) themselves. Apparently TargetFramework definitions in solution files can cause problems while publishing projects: dotnet/sdk#2902
This branch is currently seeing intermittent build errors, which seem to be related to concurrent framework builds (see dotnet/sdk#2902). Changing the logging project to explicitly target Standard 2.1 only, to see if it resolves the build issues.
@rainersigwald What is the recommended alternative if "specifying a TargetFramework at the solution level" is what I want? Is there anything else besides using the |
@LordMike Thank you for mentioning this! There seems to be a problem with the Works (with |
After switching/adding on TargetFrameworks ( In this instance we only had a single solution file, and single project, targeting >1 SDK for build. The only workaround that completely resolved the issue was to drop down CPU count to 1 to disable any parallel execution.
^ after doing this, ALL warnings were immediately eliminated and build hasn't failed since |
eading data.json F:\My University\Level Two\C# File\json\json\bin\Debug\net5.0\json.exe (process 22928) exited with code -532462766. |
Running into this with .net8 100% of the time on high core-count build servers (>64 CPUs) |
@sykhro can you please file a new issue with details about exactly what errors you're experiencing? This issue has accumulated several types of problem, and you may have a new problem with similar symptoms. |
Seeing the same on CI pipeline time to time. (docker, .NET 8)
|
Any updates? I'm experiencing the same behavior in CI environments with containers on Kubernetes. SDKs .NET 6.0 and 8.0. |
I'm encountering a similar problem. I have a build pipeline using Previously had libraries targeting netstandard2.0 and it worked perfectly. I recently transformed them to multitarget (net8.0;net427) to gain advantages of new features in all my net8.0 projects (a whole lot of them). I only have one old project still stuck on net472 (not part of the .sln mentioned above) but I need it to still be capable to be built. I then received So I added So what are the solutions? Create a step for each csproj? Use the |
UPDATE: While writing this, rather long, post -- I've managed to produce a small reproduction example, see bottom
We've recently upgraded our builds to run on faster hardware with more cpu cores, and are now ~100% of the time seeing the below error in a number of repositories. The error here is from Windows, but our CI servers run on linux and have the same error (see logs below).
We run the following commandlines:
Observations:
dotnet build MyProject.sln -f netstandard2.0
(no build script) also exhibits this issue.dotnet build MyProject.sln
seemingly always succeeds (locally and on CI server), at least for three consecutive attempts right now.MyProject.sln
havenetstandard2.0
- but a number of them have more targets (ie. netcoreapp)We have more projects, f.ex. for tests, but they're in(not relevant)MyProject-Tests.sln
. These projects only targetnetcoreapp2.x
- we've split the solutions both for speed when developing and to be able to build artifacts without compiling the tests (since we can't build certain projects from the solution only ... that's another issue entirely)/m:1
) seems to "solve" the problem.dotnet.exe
processes attempt to create the.deps.json
filesSo.
.deps.json
files?Versions:
dotnet 2.2.101
dotnet 2.2.103
(we build our own docker images using the dockerfile from the basemicrosoft/dotnet:2-sdk
images)Reproduction
Project: ci-stresstest-master.zip
In it, I have a solution with 5 projects, all empty (no actual code), but with a targeting setup that mimicks a very small subset of our projects. I've then created four seperate CI builds that did the following:
dotnet restore ci-stresstest.sln
+dotnet build ci-stresstest.sln --no-restore
dotnet build ci-stresstest.sln
dotnet restore ci-stresstest.sln
+dotnet build ci-stresstest.sln -f netstandard2.0 --no-restore
dotnet build ci-stresstest.sln -f netstandard2.0
Notes on repro.
See also #2076
The text was updated successfully, but these errors were encountered: