Click here to Skip to main content
15,891,633 members
Articles / Programming Languages / XML

How to Troubleshoot TFS Build Server Failure

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
1 Dec 2011CPOL3 min read 14.9K   3  
Troubleshooting TFS Build Server failures.

Ever found yourself in this helpless situation where you think you have tried every possible suggestion on the internet to bring the build server back but it just won’t work. Well, sometimes before hunting around for a solution, it is important to understand what the problem is. If the error messages in the build logs don’t seem to help, you can always enable tracing on the build server to get more information on what could possibly be the root cause of the failure.

image

In this blog post today, I’ll be showing you how to enable tracing on,

  • TFS 2010/11 Server
  • Build Server
  • Client

image

Enable Tracing on Team Foundation Server 2010/2011

  • On the Team Foundation Server, navigate to C:\Program Files\Microsoft Team Foundation Server 2010\Application Tier\Web Services, right click web.config, and from the context menu, select Edit.
  • image

  • Search for the <appSettings> node in the config file and set the value of the key ‘traceWriter’ to true.
  • image

  • In the <System.diagnostics> tag, set the value of switches from 0 to 4 to set the trace level to maximum to write diagnostics level trace information.
  • image

  • Restart the TFS Application pool to force this change to take effect. The application pool restart will impact any one using the TFS server at present. Note - It is recommended that you do not make any changes to the TFS production application server, this can have serious consequences and can even jeopardize the installation of your server.
  • image

  • Download the Debug view tool from http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx and set it to capture “Global Events”. Perform any actions in the Team Explorer on the client machine, you should be able to see a series of trace data in the debug view tool now.
  • image

Enable Tracing on Build Controller/Agents

  • Log on to the Build Controller/Agent and Navigate to the directory C:\Program Files\Microsoft Team Foundation Server 2010\Tools
  • image

  • Look for the configuration file ‘TFSBuildServiceHost.exe.config’ if it is not already there create a new text file and rename it to ‘TFSBuildServiceHost.exe.config
  • image

  • To Enable tracing uncomment the <system.diagnostics> and paste the snippet below if it is not already there.
  • XML
    <configuration>
      <system.diagnostics>
        <switches>
          <add name="BuildServiceTraceLevel" value="4"/>
        </switches>
        <trace autoflush="true" indentsize="4">
          <listeners>
            <add name="myListener" type="Microsoft.TeamFoundation.TeamFoundationTextWriterTraceListener,
                 Microsoft.TeamFoundation.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 
                 initializeData="c:\logs\TFSBuildServiceHost.exe.log" />
            <remove name="Default" />
          </listeners>
        </trace>
      </system.diagnostics>
    </configuration>
  • The highlighted path above is where the Log file will be created. If the folder is not already there then create the folder, also, make sure that the account running the build service has access to write to this folder.
  • image

  • Restart the build Controller/Agent service from the administration console (or net stop tfsbuildservicehost and net start tfsbuildservicehost) in order for the new setting to be picked up.
  • image

Enable TFS Tracing on the Client Machine

  • On the client machine, shut down Visual Studio, navigate to C:\Program Files\Microsoft Visual Studio 10.0\Common 7\IDE
  • image

  • Search for devenv.exe.config, make a backup copy of the config file and right click the file and from the context menu select edit. If its not already there create this file.
  • image

  • Edit devenv.exe.config by adding the below code snippet before the last </configuration> tag
  • XML
    <system.diagnostics>
      <switches>
        <add name="TeamFoundationSoapProxy" value="4" />
        <add name="VersionControl" value="4" />
      </switches>
      <trace autoflush="true" indentsize="3">
        <listeners>
          <add name="myListener"
          type="Microsoft.TeamFoundation.TeamFoundationTextWriterTraceListener,Microsoft.TeamFoundation.Common, 
              Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
              initializeData="c:\tf.log" />
          <add name="perfListener" type="Microsoft.TeamFoundation.Client.PerfTraceListener,
               Microsoft.TeamFoundation.Client, 
               Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
        </listeners>
      </trace>
    </system.diagnostics>
  • The highlighted path above is where the Log file will be created. If the folder is not already there then create the folder.
  • Start Visual Studio and after a bit of activity you should be able to see the new log file being created on the folder specified in the config file.

Other Resources

Below are some Key resource you might like to review. I would highly recommend the documentation, walkthroughs, and videos available on MSDN.

image

Thank you for taking the time out and reading this blog post. If you enjoyed the post, remember to subscribe to http://feeds.feedburner.com/TarunArora. Have you come across an interesting one to one with the build server, please share your experience here. Questions/Feedback/Suggestions, etc please leave a comment.

Thank you!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Avanade
United Kingdom United Kingdom
Solution Developer - C# .NET, ALM

Tarun Arora is a Microsoft Certified professional developer for Enterprise Applications. He has over 5 years of experience developing 'Energy Trading & Risk Management' solutions using Microsoft Technologies. Tarun has great passion for technology and travel (not necessarily in the same order)!

Comments and Discussions

 
-- There are no messages in this forum --