But it works on my PC!

The random thoughts of Richard Fennell on technology and software development

TFS Team Build compile details

Martin Woodward posted a few weeks ago about his build bunny. Now this is something I had tried a while ago for DDD4, but hit the same problem Martin had that the old Nabaztag API was too slow and messages could take hours to arrive, making it useless in the real world. Inspired by Martin and the new faster API I have been working on a new Team Build status monitor for the office.

Getting most of it going is straight forward as Martin said, the TFS API event model is easy to use. However I did have a problem getting the details of the build. I could see if it built or not, but I could not get any count of warning, code analysis errors or test results etc.

It seems the problem is that when the BuildQueue_StatusChanged event fires after a build completes it does not have all the details in the IBuildDetail object you would expect. However, if you re-query the TFS server you can get the information.

I added the following to the end of the BuildQueue_StatusChanged event handler:

// first get the handle to the queue (you might have this stored already)
TeamFoundationServer tfs = new TeamFoundationServer("http://myserver:8080");
IBuildServer buildServer = (IBuildServer)tfs.GetService(typeof(IBuildServer));
IQueuedBuildsView buildQueue = buildServer.CreateQueuedBuildsView("MyProject");

// Now re query using the project build URL to get the number of errors and warning
// the array of string list what details we want
IBuildDetail buildDetails = buildServer.GetBuild(buildQueue.QueuedBuilds
         [lastItem].Build.Uri, new string[] {

// Now use the new IBuildDetail object to update the screen associated display
// user control

Now in my display usercontrol all I need to go is to extract compiler summary details using a standard TFS  InformationNodeConverter (and you could do the same for test or code coverage).

var buildSummaries = InformationNodeConverters.GetConfigurationSummaries(build Details);
if (buildSummaries.Count > 0)
  this.lblCompileReport.Text = "[Errors:" + buildSummaries[0].TotalCompilationErrors +
  "] [Warnings:" + buildSummaries[0].TotalCompilationWarnings +
  "] [Static Analysis Errors:" + buildSummaries[0].TotalStaticAnalysisErrors +
  "] [Static Analysis Warnings:" + buildSummaries[0].TotalStaticAnalysisWarnings +"]";

CA0055 error in FXCop

I have been setting up a new Team Build server today. All our projects are being set to do code analysis (FXCop) after the build. For one project this worked on the developer PC but failed on the build machine.

The CA0055 error means 'file not found' or 'could not load' the assembly to be analysed. Firstly I suspected there was a problem with path names being over 256 characters (both the assemblies and solutions names were long) which can be a problem MSBuild, but this was not the case.

In the end I looked in the *.CodeAnalysisLog.xml file in the build directory. This gave the inner exception and I found it was a missing DLL that was referenced by a DLL the main DLL referenced - so two hops away! I added this DLL to the project references to make sure it was in the build directory and all was OK.

TIP: read the detailed FXCop log file - it shows far more than the summary in the IDE

TFS Build server and running MSTest - directory creation error

When you create a build type for a team project on TFS you can enable testing using MSTest by saying 'run any tests that are found in a given DLL'. I used this today to create a CI build for a project, I am looking at using Team Build as opposed to CruiseCrontrol as we have done historically.

I hit a problem that the tests were running but the build was failing (or in Team build speak - partial succeeding i.e. compiling but not passed testing). On looking in the build log I saw the error was:

The results directory "\\server\tfsdrop\Rel1.0.0\TestProject_20080612.1\TestResults" could not be created for publishing

So this looked like a rights issue, but my Domain\TFSBuild user (which the build process runs under) has full permissions to the drop directory (and it's associated share) and it was happily creating the other directories for the drop share.

Turns out the answer was to also give the Domain\TFSService (used by the Appliction Teir) full access to the drop share. Once this is done all is OK

Go south young man.......and read a book on a SmartPhone

I have got into reading books off my HTC smart phone using the Microsoft Reader. It means you always have a book with you (as well as a web browser, blog writer, phone etc.....)

The problem has been getting books in a suitable format, yes I know that you can buy electronic books but there are so many out of copyright classic's I have not read yet. You can download many from Project Gutenberg (and convert them to the right format using the add-in for Word) so why buy newer ones?

So recently I have been re-reading one of my favourite books, a good one to dip in and out of, "The Worst Journey in the World" about Scott's last expedition which Paul Theroux describes it as the best adventure book he’s ever read. This obviously lead me to a book on the site I have not read before "The South Pole" by Roald Amundsen.

The first thing I have to say is that in my opinion Apsley Cherry-Garrard is a far better writer than Amundsen (this maybe the translation but I doubt it). Irrespective of the style the two books read very differently Amundsen just makes it sound so matter of fact almost easy. Much of this I think is down to being bought up in a snowy land - being prepared. Scott, as has been much written, made some strange decisions often based on his poor past experiences (such as the use of dogs) and was certainly unlucky as well. Scott's is a story of the Edwardian gentleman amateur.

However, it is also interesting to see the all Edwardians not just the English had a similar view of the world - to travel, find new creatures, kill them then eat and/or stuff them.

So how do I like reading using the SmartPhone form factor? Well I find it fine usually. The only problems are that the HTC is useless direct sunlight and on the cheap short haul airlines you can't switch your phone on even in flight mode. So buy a magazine at the airport.

On the train home

Thanks to everyone who attended my session on DataDude in Edinburgh yesterday. I hope you found it useful. For those based in Yorkshire I will be doing the same session for the local SQL user group on the 16th July.

The slides I used yesterday were virtually identical to the ones I used at SQLBits II and can be found on our server. The only major change was a bit about yesterdays announcement of the GDR release that I wrote on the train up after watching the Channel9 video - but Gert's blog is a better source information for this.