Buck Hodges

Visual Studio Online, Team Foundation Server, MSDN

January, 2006

  • Buck Hodges

    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 HKCU\Software\Microsoft\.NETFramework\AssemblyFolders\Microsoft.TeamFoundation /ve /d "%programfiles%\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies" /f
    reg add HKCU\Software\Microsoft\.NETFramework\AssemblyFolders\Microsoft.TeamFoundation.Build.Common /ve /d "%programfiles%\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies" /f
    reg add HKCU\Software\Microsoft\.NETFramework\AssemblyFolders\Microsoft.TeamFoundation.Client /ve /d "%programfiles%\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies" /f
    reg add HKCU\Software\Microsoft\.NETFramework\AssemblyFolders\Microsoft.TeamFoundation.Common /ve /d "%programfiles%\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies" /f
    reg add HKCU\Software\Microsoft\.NETFramework\AssemblyFolders\Microsoft.TeamFoundation.Common.Library /ve /d "%programfiles%\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies" /f
    reg add HKCU\Software\Microsoft\.NETFramework\AssemblyFolders\Microsoft.TeamFoundation.VersionControl.Client /ve /d "%programfiles%\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies" /f
    reg add HKCU\Software\Microsoft\.NETFramework\AssemblyFolders\Microsoft.TeamFoundation.VersionControl.Common /ve /d "%programfiles%\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies" /f
    reg add HKCU\Software\Microsoft\.NETFramework\AssemblyFolders\Microsoft.TeamFoundation.VersionControl.Common.Integration /ve /d "%programfiles%\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies" /f
    reg add HKCU\Software\Microsoft\.NETFramework\AssemblyFolders\Microsoft.TeamFoundation.WorkItemTracking.Client /ve /d "%programfiles%\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies" /f
    reg add HKCU\Software\Microsoft\.NETFramework\AssemblyFolders\Microsoft.TeamFoundation.WorkItemTracking.Client.Cache /ve /d "%programfiles%\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies" /f
    reg add HKCU\Software\Microsoft\.NETFramework\AssemblyFolders\Microsoft.TeamFoundation.WorkItemTracking.Client.DataStore /ve /d "%programfiles%\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies" /f
    reg add HKCU\Software\Microsoft\.NETFramework\AssemblyFolders\Microsoft.TeamFoundation.WorkItemTracking.Client.Provision /ve /d "%programfiles%\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies" /f
    reg add HKCU\Software\Microsoft\.NETFramework\AssemblyFolders\Microsoft.TeamFoundation.WorkItemTracking.Client.QueryLanguage /ve /d "%programfiles%\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies" /f
    reg add HKCU\Software\Microsoft\.NETFramework\AssemblyFolders\Microsoft.TeamFoundation.WorkItemTracking.Client.RuleEngine /ve /d "%programfiles%\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies" /f
    reg add HKCU\Software\Microsoft\.NETFramework\AssemblyFolders\Microsoft.TeamFoundation.WorkItemTracking.Proxy /ve /d "%programfiles%\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies" /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.

  • Buck Hodges

    Migrating CVS and Subversion repositories to Team Foundation Server


    A number of users have asked about converting existing CVS and Subversion repositories to Team Foundation Server.  While we have no plans to produce such, we had hoped third parties would.  Today someone from Component Software posted an announcement of such a converter.

    Here's the description from their web page.

    CS-Converter is a powerful and reliable conversion tool, used to migrate from various legacy version control systems (such as RCS, CVS, Subversion and Visual SourceSafe) to Microsoft Team Foundation Version Control (TFVC) system.

    Disclaimer: I don't have any relationship with the company, haven't tried the software, am not endorsing it, etc., etc.

    [UPDATE 10/20/2009] With the Component Software product being discontinued, I wanted to mention that there is another company now with a tool to convert CVS and subversion to TFS called Timely Migration.

  • Buck Hodges

    Locks based on file types (extensions) and shelving


    Recently, someone asked about locks, shelving, and buddy builds (i.e., shelving your changes and unshelving and building them in another workspace to make sure everything builds cleanly).

    I am trying to add a number of files into our source control.  The list of files I want to add contains a few each of .ico and .bmp, and one .xls files, all which get locked (locked to prevent check-out) when I add them, presumably because they cannot be merged if someone else checks them out and changes them.

    The fact that they get locked seems to deny the possibility of buddy building, even on my own second machine, because they are locked on a by-workspace rather than by-user basis.

    I tried selecting the binary items in the hierarchy under the Source Control Explorer, and right-clicking to the “unlock” command, but it always says that the file could not be found in my workspace.

    What am I missing?  A preference setting or checkbox somewhere that does not lock added binary files?  Is there some way to turn off or override my own lock?  Is it really not possible to unshelve shelvesets containing binary files to a second machine?

    Locking and shelving, while keeping the changes in your workspace, don't mix.  The files that are configured to be locked via file type extension (in VS, Team -> Team Foundation Server Settings -> Source Control File Types) are locked exclusively.

    An exclusive checkout lock prevents any other changes from being pended on the file involved.  The file type locking mechanism prevents user from unlocking files that are locked via that mechanism.  So, to do a buddy build, you would need to shelve and undo, which is best accomplished by either unchecking the “Preserve local changes” checkbox in the GUI shelve dialog or using the /move option on the shelve command.  Alternatively, you can change the file types to allow multiple checkout.

    The problem is even worse for users where exclusive checkout is turned on for an entire team project, as even plain text files are locked exclusively in that case.  As with the file type extension locking mechanism, users cannot unlock files that are locked due to the team project setting.  When you shelve, you need to move the changes to the shelveset (don't keep them in your workspace).

    For us, the file type locking causes problems both with buddy builds and with a check-in system we use called gauntlet.  With gauntlet, we shelve our changes and submit them to gauntlet for it to build them and check them in.  It can't unshelve any item that requires an exclusive lock if you still have the pending change in your own workspace.  As a result, we've turned off exclusive checkout based on file extensions by changing each to allow multiple checkout.

  • Buck Hodges

    Disabling or changing output colors used by the command line (tf.exe)


    In the forum, a user asked how to turn off the colors used in the output of the version control command line for Team Foundation (tf.exe).  I thought I'd repost it here.


    When tf.exe (beta 3 refresh version) displays an error message the text is colored in yellow on black. My command prompt windows usually have black text on white background. Is it possible to let tf. exe display all output without changing the color, e.g. via an environment variable?


    You can change or turn off the coloring by changing the settings in tf.exe.config (in the same location as tf.exe).

    Here is the list of display settings.

    Display.FallbackWidth - the width the command line uses when the output is not going to the console; this is used in column calculations, separators and defaults to 80
    Display.DisableColors - turns colors on or off (defaults to true)
    Display.ErrorBackground - the background of error or warning text (defaults to black)
    Display.ErrorForeground - the foreground of error or warning text (defaults to yellow)
    Display.InfoBackground - the background of informational text (defaults to black)
    Display.InfoForeground - the foreground of informational text (defaults to cyan)

    You can turn off coloring altogether by adding the following to your tf.exe.config file.

          <add key="Display.DisableColors" value="true" />

    If you simply want to alter the coloring to make it look better, you could use something like the following.  The color choices are black, blue, cyan, darkblue, darkcyan, darkgray, darkgreen, darkmagenta, dark red, darkyellow, gray, green, magenta, red, white, and yellow.

          <add key="Display.ErrorForeground" value="blue" />
          <add key="Display.ErrorBackground" value="white" />

    Your tf.exe.config file will end up looking something like the following.

    <?xml version="1.0"?>
        <gcConcurrent enabled="true" />
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <publisherPolicy apply="yes" />
          <probing privatePath="PrivateAssemblies" />

        <add key="Display.DisableColors" value="true" />


    [Update 1/7] Fixed formatting issues.

Page 1 of 1 (4 items)