-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Publish is frequently getting Access denied to different files #2524
Comments
This one is also very common (i.e. failed to write to csproj.FileListAbsolute.txt). Diagnostics provides no additional information. C:\Program Files\dotnet\sdk\2.2.105\Microsoft.Common.CurrentVersion.targets(5106,5): error MSB3491: Could not write lines to file "obj\Release\netcoreapp2.1\win-x64\BVTagging.csproj.FileListAbsolute.txt". The process cannot access the file '...\BVTagging\obj\Release\netcoreapp2.1\win-x64\BVTagging.csproj.FileListAbsolute.txt' because it is being used by another process. [...\BVTagging.csproj] |
Is it a problem specific to your solution, or are you able to reproduce it on small solution / repro as well? Antiviruses are often known to lock files, can you check if that is the case for you? Windows tool to check is e.g. Process Monitor: https://docs.microsoft.com/en-us/sysinternals/downloads/procmon |
Thanks karlz. Not running any anti virus. Standard Windows development environment. I will try to reproduce on something smaller. But this is getting critical to production. This one is also very common: ... publish: C:\Program Files\dotnet\sdk\2.2.105\Microsoft.Common.CurrentVersion.targets(2110,5): warning MSB3088: Could not read state file "obj\Debug\netcoreapp2.1\BVData.csprojAssemblyReference.cache". The process cannot access the file '...\BVData\obj\Debug\netcoreapp2.1\BVData.csprojAssemblyReference.cache' because it is being used by another process. [...\BVData.csproj] So far tried dotnet publish 10 times this morning. Each time it fails on a different issue. |
@genifycom try a small HelloWorld. If that works, chop off pieces of your projects to find out what triggers it. If it is critical for your production, then I recommend to try lots of things in parallel to narrow down what is the problem. |
No response, closing. Feel free to reopen when there's more info. Thanks! |
This is certainly not on one machine. All developers are getting it using this solution. This is extremely difficult to isolate. It is 7 class libraries and one ASP.NET Core with dependencies between the class libraries and the ASP.NET The problem here is dotnet publish verbose gives no additional information. Is there ANY other way to debug what is going on? It happens seemingly randomly on different files. |
Process Monitor is your best hope: #2524 (comment) ... as mentioned above. |
I have this issue, too. Looks like if the solution gets bigger and the parallel build is running? This happens to me only if I call dotnet publish to the solution instead of a specific project inside the solution. I use a common output directory. Here are the .csproj settings:
… from the output:
Anyway, the publish output seems to be fine… looks like a retry is made and succeeds. p.s. AV is off here, too. Win10 VS2019, dotnet 3.1 |
Please open this back up. I'm running a sample hello world solution targeting netcoreapp3.1 on Microsoft hosted agent (Hosted Windows 2019 with VS2019), same issue when calling dotnet publish. How was this issue closed? |
More info on the build error log: Unable to use package assets cache due to I/O error. This can occur when the same project is built more than once in parallel. Performance may be degraded, but the build result will not be impacted. |
This issue was closed due to not enough information -- see above: #2524 (comment) In general we do not monitor closed bugs - especially when closed for 1+ year. I would recommend to create a new one. |
I had the same problem, and, i'm throwing a wild guess here, it seems to me that some files are held by a cache of some sort. For my case, the files that i couldn't delete (even through FTP) were the main app dll and the first referenced view dll. Only after deleting all the files through FTP that i was able to delete the two faulty files. |
Issue Title
dotnet publish is getting access to the path denied on different files each time it is run
General
During a
dotnet publish -c Release -r win-x64
the publish is failing due to access to the path denied. The specific file changes each time dotnet publish is run. This project has a main asp.net application that references 7 class libraries in separate projects. All projects are set to use netcoreapp2.1 in their csprojs.
C:\Program Files\dotnet\sdk\2.2.105\Microsoft.Common.CurrentVersion.targets(4194,5): error MSB3021: Unable to copy file "obj\Release\netcoreapp2.1\BVData.dll" to "bin\Release\netcoreapp2.1\BVData.dll". Access to the path '...\BVData\bin\Release\netcoreapp2.1\BVData.dll' is denied. [...\BVData.csproj]
Provide details on the problem you are experiencing including the .NET Core version, operating system version and anything else that is relevant.
dotnet --version 2.2.105
The published app is set for netcoreapp2.1 in the main csproj and all referenced class libraries.
Tried this into a new empty directory with diagnostics turned on. This only shows
"...\BVTagging.sln" (Publish target) (1:2) ->
"...\BVAdmin.csproj" (Publish target) (15:6) ->
"...\BVData.csproj" (default target) (4:13) ->
(CopyFilesToOutputDirectory target) ->
C:\Program Files\dotnet\sdk\2.2.105\Microsoft.Common.CurrentVersion.targets(4194,5): error MSB3021: Unable to copy file "obj\Release\netcoreapp2.1\BVData.dll" to "bin\Release\netcoreapp2.1\BVData.dll". Access to the path '...\BVData\bin\Release\netcoreapp2.1\BVData.dll' is denied. [...\BVData\BVData.csproj]
I am unable to determine who has "bin\Release\netcoreapp2.1\BVData.dll" locked.
How can I diagnose this?
The text was updated successfully, but these errors were encountered: