How to add the Team Foundation assemblies to the .NET tab in the VS Add Reference dialog


To write an app using the Team Foundation API, you’re going to need to reference assemblies that are in the GAC.  It’s not possible to add a reference to a .NET assembly in the GAC in VS when you need to add a reference to an assembly.

The GAC’ed Team Foundation assemblies are also copied to the PrivateAssemblies folder under the VS directory.  When you want to add a reference to a TFS assembly in VS solution, you can choose Browse and find the assembly.

To make it more convenient, you can also add the TFS assemblies to the .NET tab in the Add Reference dialog.  This knowledge base article describes how to add an assembly to the list in the .NET tab.

Based on that, here’s a simple batch script that will add all of the GAC’ed Team Foundation assemblies to the list.  There are probably assemblies you’ll never need to use in this list, so feel free to trim it down.  You can copy the text to a file called register.bat and run it.  The batch script assumes that you installed VS in the normal Program Files directory.  Since this script modifies your registry, all of the usual disclaimers apply, you should back it up beforehand, etc.

reg add HKCUSoftwareMicrosoft.NETFrameworkAssemblyFoldersMicrosoft.TeamFoundation /ve /d “%programfiles%Microsoft Visual Studio 8Common7IDEPrivateAssemblies” /f
reg add HKCUSoftwareMicrosoft.NETFrameworkAssemblyFoldersMicrosoft.TeamFoundation.Build.Common /ve /d “%programfiles%Microsoft Visual Studio 8Common7IDEPrivateAssemblies” /f
reg add HKCUSoftwareMicrosoft.NETFrameworkAssemblyFoldersMicrosoft.TeamFoundation.Client /ve /d “%programfiles%Microsoft Visual Studio 8Common7IDEPrivateAssemblies” /f
reg add HKCUSoftwareMicrosoft.NETFrameworkAssemblyFoldersMicrosoft.TeamFoundation.Common /ve /d “%programfiles%Microsoft Visual Studio 8Common7IDEPrivateAssemblies” /f
reg add HKCUSoftwareMicrosoft.NETFrameworkAssemblyFoldersMicrosoft.TeamFoundation.Common.Library /ve /d “%programfiles%Microsoft Visual Studio 8Common7IDEPrivateAssemblies” /f
reg add HKCUSoftwareMicrosoft.NETFrameworkAssemblyFoldersMicrosoft.TeamFoundation.VersionControl.Client /ve /d “%programfiles%Microsoft Visual Studio 8Common7IDEPrivateAssemblies” /f
reg add HKCUSoftwareMicrosoft.NETFrameworkAssemblyFoldersMicrosoft.TeamFoundation.VersionControl.Common /ve /d “%programfiles%Microsoft Visual Studio 8Common7IDEPrivateAssemblies” /f
reg add HKCUSoftwareMicrosoft.NETFrameworkAssemblyFoldersMicrosoft.TeamFoundation.VersionControl.Common.Integration /ve /d “%programfiles%Microsoft Visual Studio 8Common7IDEPrivateAssemblies” /f
reg add HKCUSoftwareMicrosoft.NETFrameworkAssemblyFoldersMicrosoft.TeamFoundation.WorkItemTracking.Client /ve /d “%programfiles%Microsoft Visual Studio 8Common7IDEPrivateAssemblies” /f
reg add HKCUSoftwareMicrosoft.NETFrameworkAssemblyFoldersMicrosoft.TeamFoundation.WorkItemTracking.Client.Cache /ve /d “%programfiles%Microsoft Visual Studio 8Common7IDEPrivateAssemblies” /f
reg add HKCUSoftwareMicrosoft.NETFrameworkAssemblyFoldersMicrosoft.TeamFoundation.WorkItemTracking.Client.DataStore /ve /d “%programfiles%Microsoft Visual Studio 8Common7IDEPrivateAssemblies” /f
reg add HKCUSoftwareMicrosoft.NETFrameworkAssemblyFoldersMicrosoft.TeamFoundation.WorkItemTracking.Client.Provision /ve /d “%programfiles%Microsoft Visual Studio 8Common7IDEPrivateAssemblies” /f
reg add HKCUSoftwareMicrosoft.NETFrameworkAssemblyFoldersMicrosoft.TeamFoundation.WorkItemTracking.Client.QueryLanguage /ve /d “%programfiles%Microsoft Visual Studio 8Common7IDEPrivateAssemblies” /f
reg add HKCUSoftwareMicrosoft.NETFrameworkAssemblyFoldersMicrosoft.TeamFoundation.WorkItemTracking.Client.RuleEngine /ve /d “%programfiles%Microsoft Visual Studio 8Common7IDEPrivateAssemblies” /f
reg add HKCUSoftwareMicrosoft.NETFrameworkAssemblyFoldersMicrosoft.TeamFoundation.WorkItemTracking.Proxy /ve /d “%programfiles%Microsoft Visual Studio 8Common7IDEPrivateAssemblies” /f

After running the script, you should see the GAC’ed Team Foundation assemblies listed in the .NET tab.

[Update 1/12]  I fixed some errors in the first couple of paragraphs.

Comments (14)

  1. Alan Stevens says:

    Thanks Buck! This is a very helpful post.

    ++Alan

  2. Luis Fraile says:

    What about SDK documentation on that assemblies?? I have tried to search for info on them for Beta 3 Refresh but no success

  3. buckh says:

    Luis, this post has the details on getting the documentation.

    http://blogs.msdn.com/buckh/archive/2005/12/09/502179.aspx

  4. Do you really need to add one key per assembly? If I remember correctly, Visual Studio simply goes through the directory and adds all assemblies in there. So only the first row in the above script is really necessary. Right?

  5. Buck Hodges says:

    Personally, I like adding only what I need. However, you might be right. I haven’t tried it.

  6. edhintz says:

    I could not find a way to add just the directory and pick up all the assemblies, so adding a file at a time is the way to go.

    If you want some more info to jump start writing a Team Foundation Version Control Add-in for Visual Studio, see http://blogs.msdn.com/edhintz/archive/2006/02/03/524312.aspx

  7. Buck Hodges says:

    Now that the RC is out, I thought I’d post a summary with links to version control posts from the last…

  8. Buck Hodges says:

    In response to a forum question about how to list the process templates on the server, Tony Edwards,…

  9. Para criar soluções que integrem ou estendam o TFS, você certamente precisará referenciar um ou mais…

  10. Buck Hodges says:

    Recently the question of how to compare files and folders came up.  TFS version 1 doesn’t have the…

  11. Robert Everett says:

    For Visual Studio 2008 use this:

    reg add HKCUSoftwareMicrosoft.NETFrameworkAssemblyFoldersMicrosoft.TeamFoundation /ve /d "%programfiles%Microsoft Visual Studio 9.0Common7IDEPrivateAssemblies" /f

    reg add HKCUSoftwareMicrosoft.NETFrameworkAssemblyFoldersMicrosoft.TeamFoundation.Build.Common /ve /d "%programfiles%Microsoft Visual Studio 9.0Common7IDEPrivateAssemblies" /f

    reg add HKCUSoftwareMicrosoft.NETFrameworkAssemblyFoldersMicrosoft.TeamFoundation.Client /ve /d "%programfiles%Microsoft Visual Studio 9.0Common7IDEPrivateAssemblies" /f

    reg add HKCUSoftwareMicrosoft.NETFrameworkAssemblyFoldersMicrosoft.TeamFoundation.Common /ve /d "%programfiles%Microsoft Visual Studio 9.0Common7IDEPrivateAssemblies" /f

    reg add HKCUSoftwareMicrosoft.NETFrameworkAssemblyFoldersMicrosoft.TeamFoundation.Common.Library /ve /d "%programfiles%Microsoft Visual Studio 9.0Common7IDEPrivateAssemblies" /f

    reg add HKCUSoftwareMicrosoft.NETFrameworkAssemblyFoldersMicrosoft.TeamFoundation.VersionControl.Client /ve /d "%programfiles%Microsoft Visual Studio 9.0Common7IDEPrivateAssemblies" /f

    reg add HKCUSoftwareMicrosoft.NETFrameworkAssemblyFoldersMicrosoft.TeamFoundation.VersionControl.Common /ve /d "%programfiles%Microsoft Visual Studio 9.0Common7IDEPrivateAssemblies" /f

    reg add HKCUSoftwareMicrosoft.NETFrameworkAssemblyFoldersMicrosoft.TeamFoundation.VersionControl.Common.Integration /ve /d "%programfiles%Microsoft Visual Studio 9.0Common7IDEPrivateAssemblies" /f

    reg add HKCUSoftwareMicrosoft.NETFrameworkAssemblyFoldersMicrosoft.TeamFoundation.WorkItemTracking.Client /ve /d "%programfiles%Microsoft Visual Studio 9.0Common7IDEPrivateAssemblies" /f

    reg add HKCUSoftwareMicrosoft.NETFrameworkAssemblyFoldersMicrosoft.TeamFoundation.WorkItemTracking.Client.Cache /ve /d "%programfiles%Microsoft Visual Studio 9.0Common7IDEPrivateAssemblies" /f

    reg add HKCUSoftwareMicrosoft.NETFrameworkAssemblyFoldersMicrosoft.TeamFoundation.WorkItemTracking.Client.DataStore /ve /d "%programfiles%Microsoft Visual Studio 9.0Common7IDEPrivateAssemblies" /f

    reg add HKCUSoftwareMicrosoft.NETFrameworkAssemblyFoldersMicrosoft.TeamFoundation.WorkItemTracking.Client.Provision /ve /d "%programfiles%Microsoft Visual Studio 9.0Common7IDEPrivateAssemblies" /f

    reg add HKCUSoftwareMicrosoft.NETFrameworkAssemblyFoldersMicrosoft.TeamFoundation.WorkItemTracking.Client.QueryLanguage /ve /d "%programfiles%Microsoft Visual Studio 9.0Common7IDEPrivateAssemblies" /f

    reg add HKCUSoftwareMicrosoft.NETFrameworkAssemblyFoldersMicrosoft.TeamFoundation.WorkItemTracking.Client.RuleEngine /ve /d "%programfiles%Microsoft Visual Studio 9.0Common7IDEPrivateAssemblies" /f

    reg add HKCUSoftwareMicrosoft.NETFrameworkAssemblyFoldersMicrosoft.TeamFoundation.WorkItemTracking.Proxy /ve /d "%programfiles%Microsoft Visual Studio 9.0Common7IDEPrivateAssemblies" /f

  12. Andrew Backer says:

    It does appear true that you only need the first line.  That will grab everything that starts with Microsoft.TeamFoundation.

    If you only wanted a subset, I suppose you could use the other lines, though.  In the end, this is all I have in my .bat:

    reg add HKCUSoftwareMicrosoft.NETFrameworkAssemblyFoldersMicrosoft.TeamFoundation /ve /d "%programfiles%Microsoft Visual Studio 9.0Common7IDEPrivateAssemblies" /f

    pause

  13. Ramandeep Singh says:

    'Microsoft.TeamFoundation.Client.TagsCacheService' from assembly 'Microsoft.TeamFoundation.Client, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. how to solve this issue???? please reply as soon as possible

  14. buckh says:

    Ramandeep, I do not understand your question.

Skip to main content