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...
Resolve MSB4019: The imported project "C:\Program Files\dotnet\sdk\1.0.0-rc4-004771\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Props" was not found or Unable to start the process. No executable found matching command "dotnet-projectmodel-server"You might encounter compilation error in Visual Studio 2015 when a new .NET Core 1 web app is created, if you have installed Visual Studio 2...
TFS 2018 RC1 is now available and you can download it from https://www.visualstudio.com/downloads/ . Release note here explains the new fea...
You needed to setup dedicated machines for testing when using Run Functional Tests and you had to execute, Deploy Test Agent step and Copy...
This extension “ Chamindac.vsts.release.task.download-artifacts ” for VSTS and TFS 2015.2.1 upwards, can be used to filter for build artifac...