I'm having the following 2 errors when trying to build on the build server:
path\to.NETFramework\Microsoft.Common.targets (3390): Could not copy "path\to\xxx.dll" to "path\to\yyy.dll". Exceeded retry count of 10. Failed.
and
path\to.NETFramework\Microsoft.Common.targets (3390): Unable to copy file "path\to\xxx.dll" to "path\to\yyy.dll". The process cannot access the file 'path\to\yyy.dll' because it is being used by another process.
Locally, it's easy to fix - closing Visual Studio and running it as admin solves the problem. However, when using the build server (Microsoft Server), I can't seem to fix the problem.
- Already tried restarting the build agent.
- Made sure my project was the only one building at the time.
- Manually deleted the dll.
- Run the agent with the
/m:1
argument.
Thanks.
EDIT: I've managed to reproduce the error locally. If I change the configurations in the configuration manager and clean->rebuild the project, it gives me the same error. However, like I said before, restarting VS solves this error, I just don't know how to do it in the server.