C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets (3797): Could not copy file “<file>” to “<bin directory>”. Exceeded retry count of 10. Failed.
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets (3797): Unable to copy file "<file>" to "<file>". The process cannot access the file “<bin directory>” because it is being used by another process.
occurs due to parallel msbuild processes running in a build trying to replace a single assembly referred more than one project parallel.
This error can cause random failures in builds which is not good. The teams may loose trust of the build system. Even if the cause of error due to code team will not pay attention since CI build failing randomly.
One way to solve this is to detect and prevent duplicate files from being copy to build output. To detect duplicate files tool explained here can be used.
How to resolve?
1. The easy fix for this is setting the build to run in a single process. Build definitions using template prior to TFS 2013 build templates, this can be set easily by going to build definition Process set “MSBuild Multi-Proc” to false.
2. However this is not possible in TFS 2013 build templates. To bring “MSBuild Multi-Proc” back to the TFS 2013 build templates follow the instructions explained in article here.
3. The other option is passing the process count to the build using “MSBuild Arguments”. using /m:1 (/maxcpucount:1) will run the build as a single process.
It is great if the latest updates to TFS can be applied as and when they are released. But for a large organization it might not be sometime...
Generally windows services are deployed by creating an msi installer. It is possible to deploy msi via VSTS/TFS release management using the...
SQL Server Integration Services (SSIS) projects can be created to perform ETL (Extract Transform and Load) operations. As Implementing of Co...
If you have upgraded the TFS from TFS 2015 to TFS 2018 you will encounter a situation where your vNext build agents 1.xx are no longer valid...
TFS 2018 RC1 is now available and you can download it from https://www.visualstudio.com/downloads/ . Release note here explains the new fea...