Features FYI How-To's News Tips & Tricks

Setting up TeamCity as Symbol and Source Server

When debugging applications with various Microsoft tools, you need to have symbol and source information, provided by the Microsoft Symbol Server and Source Server technology.

It’s been some time since we created a plugin which allows using TeamCity as a symbol and source server, and now, after some bug-fixing has been done, we decided we are ready to announce it officially.

So please welcome the TeamCity Symbol Server plugin! With just a few mouse clicks you can set up TeamCity to index the .PDB files and binaries for all your .Net applications and, once the plugin is enabled, you can easily debug applications or analyse crash dumps: your debugger will be able to automatically retrieve the required symbol files and to download the sources of the appropriate version for shared libraries referenced by you application, if, say, these modules are developed by a different team in your company and shared between several projects.

Prerequisites

To set up TeamCity as a Symbol and Source server, we assume you have the following:

  1. TeamCity server 8.0.3 or later with a project and build configuration to build your application.
  2. Debugging Tools for Windows on the agent machine(s) where your application is built (can be installed using this link).

Now all you need to do is enable the TeamCity Symbol Server plugin in TeamCity and set a number of options in your debugger.

Download and install the plugin

  1. Since the plugin is not bundled with TeamCity, download the required version from here and install the plugin as usual.
  2. Now enable the symbol server on the Administration| Integrations| Symbol Server page. You will see that it is referenced by the following URL < TEAMCITY_SERVER_URL>/app/symbols. This is the URL to be used in the Visual Studio or windbg settings.

The permissions required to access symbols and sources via the TeamCity server are default for the project developer role, and the indexed data can be accessed in both public (not requiring authorization) and authorized modes.

Tune the build configuration settings

Next we need to add the Symbol Files indexer build feature to our build configuration settings:

AddBuildFeature

Once you add the feature and save the settings, all PDB files published as build artifacts of this configuration and all related sources will be indexed.

Next let’s take a look at the files we are publishing as build artifacts. In this setup we are building an application referencing a dll and we are publishing a .zip archive which includes the application along with the PDB file and the library:

Artifacts

The plugin can handle the PDB files published separately or packed using the TeamCity artifact publishing rules.

That’s it! Now we can run the build. When the build is finished, the build log shows that source indexing was performed and symbols files signatures were collected and written to an xml file:
buildLog

The file containing symbol files signatures is published internally and is available in the TeamCity internal artifacts under .teamcity\symbols:

publishedArtifacts

Set the debugger options

Now we need to set a few options in the debugger, Visual Studio in this case:

  1. In the Debug menu, select Options and Settings, in the General section uncheck the default Enable Just My Code and Require source files to exactly match the original version options.
    If you do not have the source code on the local machine or the .pdb file does not match the source code, you can use Source Server to find and download the sources: select Enable source server support and check all the options in that section.VSDebugOptions
  2. During a debugging session in Visual Studio, the debugger automatically loads symbol files that are located in the project directory. To specify TeamCity as a symbol server, select the Symbols section on the left and add the TeamCity symbol server URL ( from the Administration| Integrations| Symbol Server page) to the list of symbol file locations.
    On the Symbols page you can also filter out or specify modules that you want the debugger to automatically load symbols for. These settings can be changed manually when you are debugging.VSSymbolSources
  3. Save your changes.

Now your debugger will load the required symbol and source files from TeamCity enabling you to successfully debug applications and crash dumps!

Try out the TeamCity Symbol Server plugin and let us know what you think!

Happy building and debugging!

image description