Archive for June 2008

Capturing MSBuild output w/Pulse

At work, we use Zutubi Pulse as a build server across the enterprise.  Since the majority of the applications we build are not written in .NET, Pulse is a good choice.  Seems to do a lot of things well, has a nice user interface, and has some advanced features.  I wish we used something that was a little more .NET friendly (like TeamCity), but with a little work I was able to have some success at making it feel that way.

 

Since it supports external executables for building projects, we just use batch scripts to build our .NET projects.  This works fine except that when a build fails, Pulse does not capture the reason why in its UI, instead you have to drill into the console output to find the cause.  I dug into Pulse’s documentation and found out that it has a post processor that meets this need.  The post processor will parse the log output and capture any errors and warnings.  All that is needed is a regular expression to capture the error and warning lines.  Here is why I use for MSBuild:

 

   1: <regex.pp name="compiler.processor">
   2:     <pattern category="error" expression="^(.*)\\\.cs\\\(\\\d+,\\\d+\\\): error(.*)\$"/>
   3:     <pattern category="warning" expression="^(.*)Microsoft.Common.targets : warning(.*)\$"/>
   4:     <pattern category="warning" expression="^(.*)\\\.cs\\\(\\\d+,\\\d+\\\): warning (.*)\$"/>
   5: </regex.pp>

 

This will capture compiler errors and warnings, and also capture warnings from MSBuild itself. 

 

In order to capture the output from our unit tests, I a wrote a converter that converts MSTest XML into JUnit XML so that Pulse can report on our unit tests.   Pulse supports JUnit natively, so converting the MSTest XML was not that complex of a task.  Unfortunately, I cannot share that code.