Showing Test Results on the Test Case work item in Visual Studio and TFS Web Access

There are times you hear nothing about a topic for over a year and then suddenly 2 clients and an MSDN forum post come up with the same request: Can we show the test results in Team Web Access now that TFS 2013 contains the Web Based Test Management features.

And the answer (for now) is: no.Not with the out-of the box product. But as many of you will know, TFS is extensible in multiple ways, plus it provides an extensive API for accessing the data stored int he Team Projects.

MVP Mathias Olausson has combined these techniques and uses the WebBrowser custom workitem control with a small web application that uses the TFS Client Object Model to read the test results from the Project Collection database. This allows everyone to put the Test Results in the Test Case work item with ease.

Now that TFS 2013 Update 3 has made the Test Plan and the Test Suite a proper work item, it should also be possible to show the rolled up status for these in these work items using the same trick! very nice!
Until Microsoft puts this directly in the product this will work pretty well as a workaround :).


Effectively use StackOverflow as a contributor

A couple of colleagues asked me last week how I manege to wade through StackOverflow to find interesting questions. They also asked why I'm active on Stack overflow at all. Let's first dive into a couple of tips for more effective management of the incoming flow of questions and then I'll try to explain what I get from being active on forums like MSDN and Stack Overflow.


Connecting to TFS from any version of Visual Studio

I've written a couple of blog posts on this subject before and thought it would  be nice to consolidate them into one big post now that Visual Studio 2013 is about to be released. There are 3 major things to consider when connecting to TFS from an older version of Visual Studio.
  • The version of TFS you want to connect to
  • The version of Visual Studio you're connecting from
  • The version of Windows you're running
In this blog post:
  1. Connecting to Team foundation Server 2013 or Visual Studio Online (formerly known as Team Foundation Service).
  2. Connecting to Team foundation Server 2012.
  3. Connecting to Team foundation Server 2010.
  4. Configuring the MSSCCI provider for Visual Studio
  5. Connecting from Visual Studio 2005, 2008 or the MSSCCI provider
Since writing this post, Microsoft has produced an updated piece of documentation (which is already behind in some aspects) that describes most of the client/server combinations. One thing it adds which I haven't described, is the list of features that are available depending on your version of Visual Studio/TFS.

If you're having issues connecting after updating, it might be required to clear your local client cache to clear up certain issues like this one. Either the official way or the hard way.

If you also want to install the Team Foundation Server Power tools to match your Visual Studio/TFS version, check out this separate post.

Update: Updated download links to the final version of Team Explorer 2013.
Update (13-11-2013): Updated download links to the final version of Visual Studio 2012 Update 4.
Update (25-11-2013): Added information on client cache and feature docs.
Update (6-1-2014): Added update for VS2010 for Windows 8 and Visual Studio 2012
Update (21-1-2014): Added update 1 for Visual Studio 2013
Update (25-8-2014): Added update 3 for Visual Studio 2013


Building a .NET application using the GitUpgradeTemplate.xaml

Today I received a request which I first found strange. A team that migrated to Git, but still wanted to use their TFS 2008 era TFSBuild.proj. After seeing the investment made in that build file, I understood :).

So we though to simply use the GitUpgradeTemplate.xaml which is provided with TFS 2013 and be done with it. But you'll see that Team Build will kick off the build and will download your TFSBuild.proj as you'd expect, but it doesn't download your sources.

Your TFSBuild.proj needs to be updated with a few properties to make it work. The minimal project file is listed below:

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
  <!-- Do not edit this -->
  <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\TeamBuild\Microsoft.TeamFoundation.Build.targets" />


    <!-- Team Foundation Build Version - DO NOT CHANGE -->


    <!-- Set this property to true for Git build. -->


In your Build Definition make sure you're using the (rather unfamiliar) vstfs:///Git/VersionedItem/{TeamProject}/{Repository}/{Branch}/{Folder-Containing-TFSBuild.proj} as your Configuration FolderPath.


Codelens features and Visual Studio versions [Updated for 2013.3ctp1]

Update: Visual Studio 2013.3 CTP 1 Adds support for Git repositories!

If you're as happy with the new CodeLens features in Visual Studio 2013 ultimate as I am, you've probably found out that some of the features rely on server side features. This means that some Code Lenses only work when you are connected to the latest version of Team Foundation Server (2013). 

Even Visual Studio Online doesn't (yet) support Code Lens. The background processing it introduces on the number of Visual Studio Online accounts that are currently active on the service is not something that should be taken lightly. Given the tremendous value of Code Lens, I expect the server dependent lenses to be enabled in the months to come, there is a UserVoice suggestion you can track for this item.

Support for Git was added in Visual Studio Update 3 and now most indicators work also when using Git as your source control provider. Even cooler is that Codelens for Git also works with 3rd party Git hosters such as GitHub. Update 4 extends that even further. The best part is that for the Git lenses, it's not required to upgrade the TFS server, these work against your local repo and thus don't need server side processing.

CodeLens is currently only supported when editing C# and VB.NET. C++ (managed and unmanaged), Javascript, TypeScript and F# or any other file format are currently not supported.

LensTeam Foundation Server versionVisual Studio Online 3rd Party
≤2010 2012 2013
Test Status**yesyesyesyesyesyesyes
Tested By**yesyesyesyesyesyesyes
Authorsnonoyes*yes (u3)noyes (u3)Git (u3)
Changesnonoyes*yes (u3)noyes (u3)Git (u3)
Bugs update 1nonoyes*yes (u3)noyes (u3)no
Work Items update 1nonoyes*yes (u3)noyes (u3)no
Code Reviews update 1nonoyes*nononono
Code Health add-onyesyesyesyesyesyesyes
Incoming Changes update 3 & 4yesyesyesyesnoyesGit
Intellitrace update 2???????

* Works only when connected to your Team foundation Server.
** Supports MsTest, XUnit (requires latest adapter version) and NUnit.

If you have an idea for a new Code Lens, please submit your suggestion here.

I will update this table when new Lenses appear or when new Lenses are enabled on another Server, Source Control Repository or on Visual Studio Online.


Controlling whether CodeLens runs

Don't get me wrong, I just *LOVE* CodeLens, but I've found a few times where I want to control it's server jobs.

A few scenario's where I don't need CodeLens running for my Project:

  • The project is an archive and isn't actively used
  • None of the developers on the team have an MSDN Ultimate license
  • You're upgrading a massive TFS server and want to control which Project Collections are processed first.
I didn't actually know that there was an option to control Code Lens indexing until today, thanks to Mathew Aniyan.

To activate or deactivate the indexing at a Project Collection Level, you can use the TFSConfig CodeIndex command, as outlined here. You can get finer granularity by adding Ignore paths to the list.

To turn off for the whole collection use: 

tfsConfig codeindex /collectionName:DefaultCollection /setIndexing:off

To turn off for a specific team project use:

tfsConfig codeindex /collectionName:DefaultCollection /ignoreList:add $/ProjectName/*

This will allow you to reduce the amount of processing required after an upgrade by excluding old data and it can improve the performance a little should you have a TFS server which has been sized tightly.

Even though "tfsconfig codeindex /?" doesn't really explain this, one can use a wildcard at the start or end of the path:

Command: codeindex
Adding to or removing from the ignore list requires a valid path to be specified.
Wildcards ('*') are allowed as the first and/or last characters of the path.

Work item customization doesn't get reflected in Web Access (2012 and 2013)

In our company we have quite a few custom process templates for TFS, most of these have been around for quite some time and have been updated as new versions have come along. Recently I was asked by a number of people why their changes made to the Form Layout don't get reflected in TFS 2013 Web Access, and after taking them though all of the things to check (IIS Reset of the AT, clear work item cache etc), they still failed to show up.

So I started digging. First thing we found is that Web Access can get cranky if Custom Work item Controls are missing. Visual Studio will happily render a TextBox or DropdownBox so that you get some working UI, Web Access behaves slightly different; it just hides the whole control from the form. So if you're using any custom controls, make sure that they're installed on both the Web Access server and inside the version of Visual Studio you're using to change the process template. They should be listed and enabled on the Admin page:

There's a very funny 'bug' in the Power Tools Process template editor, it will not tell you that you're missing a control. It will simply show FieldControl in the UI, since the PreferredType isn't available from the Work Item Form Designer. Very annoying, so it took some actual XML digging to find items like these.

And then the second thing we ran into, is that many of our old work item definitions used to have more than one tags. One for Windows, one for Web. There's a number of very picky rules to keep in mind here and in general I feel that it's much easier to just have both use the same layout. Most the templates were created long before any of these rules were documented in blogs, causing all kinds of funny things to happen. Going back to a single layout makes it all a lot easier to manage.

A thing to look out for when using the Power tools is that again it doesn't show you everything. When you open a WIT that has multiple layouts, the Power Tools designer will only show you the *first* one. It doesn't even tell you that there are others.

Just a few lessons learned :S.