Visual Studio Online is now Visual Studio Team Services


In an attempt to remove the confusion whether Visual Studio Online is an IDE in the Cloud, Microsoft has decided to rename Visual Studio Online to:

Visual Studio Team Services

Which nicely abbreviates to VSTS, an acronym people who were using TFS in the 2005 and 2008 era may remember :). In remembrance of that great heritage:

Note to self: Here we go again, renaming all tags on the blog and trying to get the StackOverflow tag renamed *again*.

Debug your TFS/VSO 2015 builds

The new build engine of Visual Studio Online and TFS 2015 is great. It's simple, easy to configure and doesn't require complex workflow designers. But when it's not doing exactly what you want it to do, it can be hard to figure out where it's going wrong.

There is a trick to enable verbose logging on the tasks of your build, which will make them generate lot more information. This additional information has saved me more than once since I learned of the existence of this trick.

To enable debug logging simply create an extra build variable called System.Debug and set the value to true.

Enable parallel execution of tests using the Visual Studio Test Runner 2015.1


Does your machine have multiple CPU's or cores? Are your tests truly independent and thread safe? In that case you'll be able to speed up your test runs considerably by enabling multi-threaded support to the Visual Studio Test Runner.

This works in both Visual Studio as on your build server.

To get the benefits, add the following snippet to your .runsettings file:

<?xml version="1.0" encoding="utf-8"?>
    <!-- Add this line, default is 0, which makes it run single threaded -->

This is an all or nothing setting in Visual Studio, but in TFS Build you can specify multiple test runs, each with their own .runsettings. So for your CI build you'll be able to run all your unit tests in parallel, but then execute your integration tests serially, if needed.

This setting is built into the test runner, as such it doesn't require special support from the test adapters for the different frameworks.

C# Interpolated Strings in older .NET frameworks


When targeting a .NET 4.0 or 4.5 project it's not possible by default to use the Interpolated Strings and their FormattableString and IFormattable counterparts. By default

But, this is only because these two types didn't ship with the older version of the .NET Framework. If you make sure these classes are available to the C#6 compiler, it will happily produce an assembly which is compatible with the older versions of the .NET framework, since these interpolated strings are a language feature and not dependent on the Common Language Runtime.

You'll need these classes to pass a CultureInfo in order to satisfy Code Analysis 1305.

Someone beat me to creating a NuGet Package of the classes required, which makes this as simple as running:

install-package StringInterpolationBridge

C# 6 Interpolated Strings and Code Analysis (CA1305)

C# 6 introduces a new concept, Interpolated Strings, sort of the compiler version of String.Format. It's a great way to ensure that the compiler checks that your variables actually exist and that you're passing the right number of 'm.

And as with String.Format it's important to pass the correct CultureInfo to it to ensure that you're showing the right date formats, "." or "," as decimal separator etc.

By default it will use the CurrentCulture, which makes sense when formatting data to display them in the User Interface. In many other cases, however, you'd want to format your data in Invariant form, when writing to a file, calling an external service or storing data in a database.

To ensure that you, as a developer have thought about this, there is a Static Code Analysis rule that ships with Visual Studio, CA1305: Specify IFormatProvider. Unfortunately the documentation of this rule has not been updated to show how to supply the IFormatProvider or CultureInfo to an Interpolated String.

There are multiple ways to handle this, but all involve casting the Interpolated String to a FormattableString or a IFormattable. The way that's the most straightforward is to cast the formattable string and then call .Tostring on it:

FormattableString fss = $"Hello, {name}";

While this works, it'll probably drive every developer crazy, having to create a variable or being creative with casting:

((FormattableString) $"Hello, {name}").ToString(CultureInfo.InvariantCulture);

which won't make your code easier to read one bit, I'd almost stick to String.Format ;).

There is a very interesting trick which combines another C#6 feature, static imports and the calling the Invariant method:

using static System.FormattableString;
string x = Invariant($"The value is {m}");

Unfortunately, Microsoft decided to not create a static CurrentUI nor the static Current variant, which I feel is a shame. Or course it would not take much to create your own versions of these static methods:

public static string Current(FormattableString formattable)
    if (formattable == null)
        throw new ArgumentNullException("formattable");
    return formattable.ToString(Globalization.CultureInfo.CurrentCulture);

public static string CurrentUI(FormattableString formattable)
    if (formattable == null)
        throw new ArgumentNullException("formattable");
    return formattable.ToString(Globalization.CultureInfo.CurrentUICulture);

See also:

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 2015 or Visual Studio Online.
  2. Connecting to Team Foundation Server 2013.
  3. Connecting to Team Foundation Server 2012.
  4. Connecting to Team Foundation Server 2010.
  5. Configuring the MSSCCI provider for Visual Studio
  6. 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
Update (21-7-2015): Added update 5 for Visual Studio 2013 and Visual Studio and TFS 2015. Since Visual Studio 2013 Update 5 contains updates to handle TFS 2015 Team Project Renames, it's recommended for anyone connecting Visual Studio or MSSCCI 2013 to TFS 2015.
Update (22-7-2015): Added update 5RC for Visual studio 2012.Since Visual Studio 2012 Update 5RC contains updates to handle TFS 2015 Team Project Renames, it's recommended for anyone connecting Visual Studio or MSSCCI 2012 to TFS 2015.
Update (26-8-2015): Replaced Visual Studio 2012 Update 5 RC with the final version.
Update (30-8-2015): MSSCCI 2013 now also supports Visual Studio Team Foundation Server 2015. But it still depends on Team Explorer 2013.
Update (27-10-2015): IntelliJ IDE's support added

Turn off Visual Basic 14 language features in Visual Studio 2015


If you're on a team that's doing solution round-tripping between Visual Studio 2013 and 2015, then it's usually a good idea to turn off the latest Language features. That way you don't break the 2013 users, yet are able to use all the other new goodies that 2015 brings.

The C# Project Properties offer a nice UI feature to do this, even though it's well hidden in the property pages.

Visual Basic .NET doesn't have the UI, but it does have the same feature. When you change the property in the UI of the C# project it sets a <langversion> tag in your project file:

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">

Doing the same thing in your .vbroj actually has the desired result:

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">

This is the result:


Search This Blog


Most Reading