Cannot add new build templates or create team projects on TFS 2010 because of error ‘The File Exists’

The following tale from the support lines comes to us today from Premal Ghelashah.

Recently I was working on an issue where we were facing problems registering new build templates. The error message said that “The File exists”. We were facing this issue while adding templates by any name.


We were also facing issues creating new team project:



The Application event log had the following entry:

TF53010: The following error has occurred in a Team Foundation component or extension:
Date (UTC): 13/08/2013 14:45:51
Machine: zzzzzz
Application Domain: /LM/W3SVC/8080/ROOT/tfs-1-130208782708232421
Assembly: Microsoft.TeamFoundation.Framework.Server, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a; v2.0.50727
Service Host: 69ee1f98-86e8-48b3-9bb9-673d8c2bad5d (Eyetech Group Projects)
Process Details:
  Process Name: w3wp
  Process Id: 3836
  Thread Id: 1820
  Account name: xxxxx\yyyyy

Detailed Message: TF30065: An unhandled exception occurred.

Web Request Details
    Url: http://zzzzz:8080/tfs/_tfs_resources/Build/v3.0/BuildService.asmx [method: POST]
    User Agent: Team Foundation (devenv.exe, 10.0.40219.371)
    Headers: Content-Length=544&Content-Type=application%2fsoap%2bxml%3b+charset%3dutf-8&Accept-Encoding=gzip&Accept-Language=en-GB&Expect=100-continue&Host=etg-softdev%3a8080&User-Agent=Team+Foundation+(devenv.exe%2c+10.0.40219.371)&X-TFS-Version=
    Path: /tfs/_tfs_resources/Build/v3.0/BuildService.asmx
    Local Request: True
    Host Address: ::1
    User: xxxxx\yyyyyy[authentication type: NTLM]

Exception Message: The file exists.
 (type IOException)

Exception Stack Trace:    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.Path.InternalGetTempFileName(Boolean checkHost)
   at Microsoft.TeamFoundation.Build.Server.ProcessTemplate.UpdateCachedProcessParameters(TeamFoundationRequestContext requestContext, VersionSpec versionSpec)
   at Microsoft.TeamFoundation.Build.Server.TeamFoundationBuildService.AddProcessTemplates(TeamFoundationRequestContext requestContext, IList`1 processTemplates)
   at Microsoft.TeamFoundation.Build.Server.BuildWebService.AddProcessTemplates(ProcessTemplate[] processTemplates)


FIX: Clearing the content of the following cache folder location resolved issue with build and team project creation. Apparently the folders cannot handle more than 65k files and we start facing this issue.

C:\Users\<tfsservice account>\AppData\Local\Temp

As soon as we cleared this folder, issue got resolved!!

Comments (2)

  1. Clearing the cache content of temp folder solves the problem, but you need to understand which cache to clear. For some people, the key issue to solving this problem is in locating the actual TFSService in your environment. On some installation, TFS Service could be Network Service (when using a domain controller) or Local System when using Peer to Peer network. In that case the solution with this address C:\Users\\AppData\Local\Temp will become confusing and unhelpful. The actual location will then be C:\\ServiceProfiles\NetworkService\AppData\Local\Temp. Once you clear the content of this folder you build should start working correctly. So you need to understand the way your TFS is setup if you have this problem and are trying to solve it. This information could save you hours of hair pulling searches.

    1. Update to the comments: “Peer to Peer network” should read WorkGroup. And the address of Network Service Local Temp should be: C:\Windows\ServiceProfiles\NetworkService\AppData\Local\Temp

Skip to main content