TFS Build Error: The process cannot access the file 'data.coverage' because it is being used by another process
Last week we had a situation on our build server where the build was running indefinitely. After stopping the build, the following error was thrown:
The process cannot access the file 'data.coverage' because it is being used by another process.
As the problem only happened when code coverage was enabled, I guessed that it had to do something with the test runner. One thing I noticed on the build machine that the VSPerfmon.exe kept running.
After killing this process, the build completed and the issue was gone.