I constantly get file access issues when rebuilding in Windows
One of my solutions contains 37 projects that builds Nuget packages. Whenever I "rebuild solution" I always get these kinds of issues:
```
NuGet.Build.Tasks.Pack.targets(175, 5): [MSB3061] Unable to delete file "<path to Nuget project>\bin\Debug\<name of project>.nupkg". Access to the path '<path to Nuget project>\bin\Debug\<name of project>.nupkg' is denied.
```
The only way to remedy this seems to be to open that project, remove the .\obj folder and then restore Nugets for that project. That usually result in another project causing this same issue but after four or five such iterations it usually works out. This is very annoying and I have't been able to figure out what is causing it. I have tested running Rider as admin but that doesn't help.
Can someone help me understand why this happens?
Please sign in to leave a comment.
Hello Jonas,

If you Clean and Rebuild your Solution, would it help?
Do you have VisualStudio opened at the moment you experience this issue?
I have tried cleaning the solution but, in fact, that is another situation that can also cause this problem, as it (apparently) attempts removing files.
I do not run Visual Studio when this happens, nor do I have Windows Explorer opened and targeting any of the affected folders. I do have Git Kraken open, usually, but that should not be a problem.
Hello Jonas,
could you please verify that files that produce these errors exist and indeed are located in the specified folder and that the account used to run Rider and MSBuild has write permissions to the file and folders?
If that is not the case, please provide a full bundle of logs collected after Rebuild solution fails. To collect logs, click Help | Collect Logs and attach the archive with log files. And please specify if you have parallel build configured for your solution (BuildInParallel parameter for MSBuild).