Setting up Source Server for TFS Builds#

[Update 30/04/2008] Fixed issue for Build Definition names that contain spaces.

I've read about symbol servers and source servers before (in John Robbins' excellent Debugging Microsoft .NET 2.0 Applications book, for example, and also due to the recent news that Visual Studio 2008 will support source-code debugging of the .NET Framework Libraries), but never really got around to trying them out since they seemed pretty complex to set up. However, I've recently set up a source server on a Team Foundation build server (twice!), and my eyes have now gone wide open: anybody who references assemblies built by those TFS build servers can now seamlessly debug them.

When an assembly is "source server-enabled", the pdb file will contain the full path and the exact version of the file in source control that was used to build that assembly. If the debugger then enters a method, Visual Studio automatically downloads that correct file, places it in a local cache, and opens it for debugging. This is super sweet!

Now the hard work was already done and published by Roy Osherove, but there were some extra steps to take if you wanted to integrate this in a real Team Build (i.e. on the TFS build server instead of on a local machine) and it also lacked some additional information to get everything working. So I put together a full document that covers all aspects of setting up a source server, modifying the Team Build script, configuring the project files, and finally configuring the development machines.

The full document (PDF) can be downloaded here, and you can read the one-page summary that briefly covers the required steps below. I cannot recommend setting up a source server enough, it's free and takes less than an hour if you simply follow the procedure, and the advantages are - hopefully - obvious.

Setting up Source Server for TFS Builds.pdf (597 KB)

Note that this procedure works for both TFS 2005 as TFS 2008.

Installing Source Server on the Build Server

@call "%~dp0SSIndex.cmd" -SYSTEM=TF -SYMBOLS=%1 %*
  • In the srcsrv.ini file in that directory, set MYSERVER to the exact URL of your Team Foundation Server (Application Tier)
  • Add the full path to TF.exe (usually "C:\Program Files\Microsoft Visual Studio 8\Common7\IDE") to the system's Path environment variable
  • Restart the Team Build Service
Enabling Source Server in the Team Build Script
  • Add a new target to be run on "AfterCompile" that calls TFIndex.cmd:
<Target Name="RunSourceServerIndexing">
<Exec Command="&quot;C:\Program Files\Debugging Tools for Windows\sdk\srcsrv\TFIndex.cmd&quot; &quot;$(BinariesRoot)&quot;"
        WorkingDirectory="$(SolutionRoot)" /> </Target> <Target Name="AfterCompile"
        DependsOnTargets="RunSourceServerIndexing" />
Configuring the Project Files
  • Set the Debug Info in Project Properties / Build / Advanced to "full" (Debug configuration) or "pdb-only" (Release configuration)
Configuring the Development Machines
  • In Visual Studio / Tools / Options / Debugging / General: check the "Enable source server support" checkbox
  • Create a new text file named srcsrv.ini in "C:\Program Files\Microsoft Visual Studio 8\Common7\IDE" that contains the exact following text:
[trusted commands] 
cmd.exe /c TF.exe view
Monday, April 07, 2008 11:18:46 PM (Romance Standard Time, UTC+01:00)
Great! This works flawlessly in VSTS 2005 and VSTS 2008!
Comments are closed.
All content © 2008, Jelle Druyts
On this page

Recent Photos
www.flickr.com
This is a Flickr badge showing public photos from Jelle Druyts. Make your own badge here.
Advertising
Top Picks
Statistics
Total Posts: 344
This Year: 7
This Month: 0
This Week: 0
Comments: 522
Archives
Sitemap
Disclaimer
This is my personal website, not my boss', not my mother's, and certainly not the pope's. My personal opinions may be irrelevant, inaccurate, boring or even plain wrong, I'm sorry if that makes you feel uncomfortable. But then again, you don't have to read them, I just hope you'll find something interesting here now and then. I'll certainly do my best. But if you don't like it, go read the pope's blog. I'm sure it's fascinating.

Powered by:
newtelligence dasBlog 2.0.7226.0

Sign In