0

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.

  1. Already tried restarting the build agent.
  2. Made sure my project was the only one building at the time.
  3. Manually deleted the dll.
  4. 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.

2 Answers2

1

If you are using XAML build you could try to solve this problem via a setting of disable the parallel build in the build server.For TFS2010 and TFS2012 setting MSBuild Multi-Proc on the Process tab to False, for TFS2013, TFS2015 type the /m:1 in MSBuild Arguments. For more information about the /m argument in MSBuild, please refer to this document: MSBuild Command-Line Reference

Switching to single process builds has increased the build time, but if it's an acceptable loss. You could use this as a workaround.

PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62
  • I'm using TFS2015. Tried the `/m:1` argument but didn't worked. Know any other possible solution? – Henrique Moisés Dec 12 '16 at 10:15
  • I have set the Agent to run MSBuild in x86. It has to be this way because some projects that I have only run in x86. However, there are others that and others can run in x64. I think the problem may be from this. – Henrique Moisés Dec 12 '16 at 17:18
1

Finally managed to find the solution. Turns out it had nothing to do with TFS itself. I wasn't able to reproduce the error locally because, for some reason, it was compiling when it shouldn't.

My problem was "broken references". I am using some Biztalk programs and 5 of them had a dependency to other project (custom Biztalk Pipeline Components), but not the reference to the project itself. I think this maybe was caused by opening the components toolbox, although I'm not sure of it.

So, I manually removed and added again the references (Add->Reference) to said projects and now everything works like a charm.