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)yesyes (u3)Git (u3)
Changesnonoyes*yes (u3)yesyes (u3)Git (u3)
Bugs update 1nonoyes*yes (u3)yesyes (u3)no
Work Items update 1nonoyes*yes (u3)yesyes (u3)no
Code Reviews update 1nonoyes*noyesnono
Code Health add-onyesyesyesyesyesyesyes
Incoming Changes update 3&4yesyesyesyesyesyesGit
Intellitrace update 2yesyesyesyesyesyesyes

* 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.

Most Reading