Managing Multiple TFS Build Agents with tag

In last post I explain how to run code coverage during a Tfs Build and I mentioned the fact that to run code coverage you need to have Visual Studio premium or ultimate in the build machine. But what happens when you have multiple configured test agent, and only some of them have VS installed?

The solution to such a problem is using tags with the build agents. Basically a tag is a string that gets assigned to a build agent, and identify some capabilities of the Agent Itself. In our example, we can define a tag called VSUltimate that is used for each build agent that runs on a machine with Visual Studio Ultimate installed. Adding a tag is just a matter of going to the Agent Configuration

image

One good aspect of tagging, is that TFS remembers all inserted tags, so when it is time to configure tagging on another build agent, you got a list of all tags already used. You can verify from the above picture that this agent has the VSUltimate tag, but not the Windows7 one.

Now you can simply choose in the build definition the tag you require for the build. In our example, since our build should collect code coverage result, I want it to be executed from an agent that has Visual Studio Ultimate installed.

image

Thanks to the tag system you can simply specify in the build the feature you need to run the build itself.

alk.