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.
Jason Sankey:
Hi Eric,
Thanks for sharing some Pulse tips with the world. You may be happy to hear that we have just released a new beta build of Pulse 2.0 (2.0.12) which has some built-in support for MsBuild. The support includes a new command, project type and post-processor for MsBuild. Pulse will even autodetect installed versions of MsBuild and add them as resources for your build agent. No MsTest XML parsing yet, but we will get there
. If you get a chance to try 2.0 it out, we’d love to here what you think of the new features!
September 29, 2008, 9:41 pm