Search Wiki:

Team Foundation Server 2010 Sample Warehouse Adapter - CSharp Assembly Code Churn


This sample demonstrates a basic implementation of a Team Foundation Server 2010 Warehouse Adapter.

This Adapter adds CSharp Assembly to File mappings into the Warehouse primarily for use with the out-of-box code churn metrics. It is not intended to be a production Adapter (there are several limitations to the approach) but instead demonstrates the general approach for those wishing to customize the TFS Warehouse.

Getting Started

  • Download and install (see below)
  • Build and run the sample (see below)


  • Visual Studio 2010
  • Team Foundation Server 2010


  • Download the zip file associated with the sample
  • Unzip the sample to your machine

Building and running the sample

  • Open the .sln in Visual Studio 2010 (double click to open)
  • Resolve the Team Foundation Server assembly dependencies
    • CSharpAssemblyCodeChurnSample.Adapter Project
      • Micorosft.AnalysisServices - Location: GAC on computer with Microsoft SQL Server Analysis Services installed or download "Microsoft SQL Server 2005 Management Objects Collection" from
      • Microsoft.TeamFoundation.Framework.Server - Location: <TFS 2010 Server install location>\Application Tier\TFSJobAgent\
      • Microsoft.TeamFoundation.Server - Location: <TFS 2010 Server install location>\Application Tier\TFSJobAgent\
      • Microsoft.TeamFoundation.VersionControl.Common - Location: GAC on TFS 2010 Server computer
      • Microsoft.TeamFoundation.VersionControl.Server - Location: <TFS 2010 Server install location>\Application Tier\TFSJobAgent\plugins
      • Microsoft.TeamFoundation.Warehouse - Location: <TFS 2010 Server install location>\Application Tier\TFSJobAgent\plugins
    • SetupCSharpCodeChurnAdapter Project
      • Microsoft.TeamFoundation.Client - Location: GAC on TFS 2010 Server computer
  • Build the Solution
  • Install and configure the custom Adapter
    • Follow the instructions in the ManageCustomWarehouseJob.cs file in the SetupCSharpCodeChurnAdapter Project.

File List

CSharpAssemblyCodeChurnSample.Adapter Project
  • AdapterConstants.cs - Some constants (i.e. table names) used throughtout the adapter.
  • AnalysisDatabase.cs - Wrapper class for creating Analysis DB schema.
  • ChangesetProcessor.cs - Main class handling ETL for assembly and assembly mappings.
  • CSharpAssemblyCodeChurnSampleAdapter.cs - The main adapter. This is the object loaded by TFS and controls ETL and schema generation.
  • ServicingVersion.cs - Class to check schema version stamp in Warehouse and Analysis DB.
  • WarehouseDatabase.cs - Simple wrapper class on top of the Warehouse for creating schema and performing ETL.
  • WarehouseJobService.cs - Simple wrapper on the Job Service to queue the Warehouse Analysis Full Process job.
  • WarehouseTable.cs - Simple wrapper on a Warehouse table. See WarehouseDatabase.cs.
  • WarehouseTables.cs - Simple wrapper on a Warehouse table - strongly typed tables related to this adaper. See WarehouseDatabase.cs.
  • CreateCSharpAssemblyAddUpdateProcedure.sql - TQL to Add CSharp Assembly entries.
  • CreateCSharpAssemblyDestroyProcedure.sql - TSQL to Destroy CSharp Assembly entries.
  • CreateCSharpAssemblyTable.sql - TSQL to Create the CSharp Assembly table.
  • CreateCSharpAssemblyToFilesMappingAddUpdateProcedure.sql - TSQL to Add entries to the CSharp Assembly to File mapping.
  • CreateCSharpAssemblyToFilesMappingTable.sql - TSQL to Create the CSharp Assembly to File mapping table.
  • CreateCustomSqlMessages.sql - TSQL to add custom error messages to SQL.
SetupCSharpCodeChurnAdapter Project
  • ManageCustomWarehouseJob.cs - Simple console application to create and schedule the Adapter as a Warehouse job.
  • WarehouseJobManager.cs - Wrapper on top of the TFS Job Server to help create/schedule Warehouse jobs.

Additional Resources

If you have any additional resources you would like to share with the customer, add it here.

**Delete the following note before publishing **

This resource page is currently in setup mode and only available to coordinators and developers. Once you have finished setting up your resource page you can publish it to make it available to all MSDN Code Gallery visitors.

To get your Resource Page ready to publish, you should do the following:
  1. Make any changes to the details of your resource page
    1. Here you can enable or disable functions of your resource page. You might want to turn on the Issue Tracker to allow users to provide feedback on your resource, or if you have a resource that does not involve a code sample, you may want to turn off the Releases tab.
    2. Make sure your resource page description is detailed enough to let people search for your resource.
  2. Add your code sample or other resources to the resource page
    1. If you’re uploading code, go to the Releases tab and create a new release to house your code. Creating a release allows you to have the license properly displayed when people download your code, as well as provides a download count.
    2. Edit your Wiki page to attach any resources you may have that are not source code.
  3. If you want to let someone see your resource page before it is published, go to the People tab and add them to your resource page
    1. This will let you add other team members who may be contributing to your resource, or just show it off and get feedback from someone you trust.
  4. Tag your resource page with descriptive tags to make it easier for people to find your resources when browsing the gallery.
  5. Publish your resource page so it becomes visible to everyone!

Additional information on starting a new resource page is available here: Resource Page Startup Guide.
Last edited Apr 1 2010 at 3:33 PM  by nericson, version 6
Page view tracker