I recently had a very strange error while using the TFS API. The error was with the following code:
var tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(URI)); var vcs = tfs.GetService<VersionControlServer>(); var buildServer = tfs.GetService<IBuildServer>();
The problem being that `buildServer` was being set to null. I had the TFS server set-up locally, and there was a controller, an agent and a build configured.
I spent a good while trying to debug, what I thought was, an error with the code.
Turns out the problem was with the reference:
The problem was that I was referencing the wrong version (trying to connect to TFS2013 but the build client version was 126.96.36.199). Swapping it to version 188.8.131.52 works fine.
It sounds like a silly mistake, but if you make it, it’s very difficult to spot.