Team Foundation Build uses the TEMP folder of the build agent user as is working directory. After many builds, the process fails because it tries to create a file that already exists in that folder.
In our development process, we use a build server running Visual Studio Team Foundation Build Service Host 2012 to promote code from TFS to our Test environment.
To resolve the file already exists error, we cleaned the TEMP folder so the build can create the files it needs.
Here are the steps we used:
- Log into your build server.
- Stop the Visual Studio Team Foundation Build Service Host 2012 service.
- Clean the TEMP folder of the user running build agent. You can found the folder at C:\Users\%BuildAgentUser%\AppData\Local\Temp.
- Start the service.
We resumed our build process and it works accordingly.
We’ve been promoting code with this method for over 2 years. It’s the first time that this problem occurs. To resolve this issue, the next step could be to create a process that clean that folder once in awhile.