Name

.NET Support for Bamboo

Version

2.1.17

Product Versions

1.2.x/2.x

Author(s)

Ross Rowe

Homepage

http://confluence.atlassian.com/display/BAMEXT/.NET+Support

Price

Free

License

BSD

JavaDocs

See nant_builder.zip

IssueTracking

http://developer.atlassian.com/jira/browse/NANT

Subversion URL

https://svn.atlassian.com/svn/public/contrib/bamboo/bamboo-nantbuilder-plugin

or browse via fisheye

Download JAR

nant_builder-1.0.5.jar (supports 1.2.x)/nant_builder-2.1.4.jar (supports 2.0.x)/nant_builder-2.1.17.jar (supports 2.1.x and higher)

Download Source

nant_builder.zip

Description/Features

A builder plugin that will allow configuration and execution of build files for .Net/Mono projects,
using NAnt, Msbuild and devenv and also supports the parsing and displaying of NUnit, MBUnit and MSTest test results
.

This plugin will allow you to configure a single Bamboo instance handle building both your Java and .Net projects, which is especially useful if you have multi-discipline teams in your organization.

Upgrading to Bamboo 2.1 and 2.2

If you're upgrading to Bamboo 2.1 or 2.2, then you will also need to upgrade the NAnt Builder plugin to the latest version.

Prerequisites

In order to use the NAnt Builder, you must first install NAnt, which can be obtained from http://nant.sourceforge.net. In addition, you will also need to install an
appropriate version of the .Net framework, which can be downloaded from http://msdn2.microsoft.com/en-us/netframework/aa569263.aspx or the Mono framework, which can be downloaded from http://www.mono-project.com/Downloads.

This plugin has been tested using .Net Framework v2.0 on Windows XP and Mono v1.2 on OS X using both Bamboo v1.2.x and v2.0.x If you encounter any difficulties with this builder on other platforms, please let me know and I'll endeavor to resolve the issue.

Usage

Installation

Copy the nant_builder-2.1.16.jar file into your <BAMBOO_HOME>/webapp/WEB-INF/lib directory and restart Bamboo. Please note that nant_builder-2.X.X.jar supports Bamboo 2.x, and the nant_builder-1.X.X.jar supports Bamboo 1.x.

Make sure that any older versions of the plugin are removed first!

NAnt

  1. Create a new NAnt Builder via the Builders tab on the Administration page. You should be able to select NAnt as a builder type, you will need to enter a label and include the location to the path to the NAnt directory.
  2. Once you have created a NAnt Builder, you can configure a project to use this builder via the Builder Configuration tab of the Configuration page. Here you can specify the name of the build file, the target to execute, NAnt options, environment variables, and the working sub directory.

NUnit/MBUnit/MSTest

  1. If your build produces NUnit, MBUnit and/or MSTest test results, then enter the location of the test result files on the Builder Configuration tab.

The builder will run in the same manner as the Ant and Maven builders ie. the build output will be captured by Bamboo and displayed on the Build Log page. A build will be deemed 'successful' (and thereby appear in the shiny green colour) if the NAnt build finishes with a return code of 0 and if the last 5 lines of the NAnt build include the words 'BUILD SUCCEEDED'. In addition, if the build has been configured to run NUnit tests, a build will be deemed successful if all the tests pass. If any of these conditions are not met, then the build will be deemed to have 'failed'.

devenv.com

A devenv.com builder as well, which works in the same sort of way as the NAnt Builder and includes the support for parsing and recording NUnit test results. The devenv.com executable is included as part of Microsoft Visual Studio and allows you to build a Visual Studio Solution from the command line.

You first need to add the Builder via the Administration page

Once the builder has been added, you can use this builder in your build's Configuration.

Msbuild

Similar to the devenv builder, support for Msbuild has also been included.

.NET Script/Command builds

Generic .NET Script and Command builders are included also. These builders allow you to specify a custom command or script to be used as part of a build's execution, but which allow the parsing and displaying of NUnit/MBUnit test results.

NCover

If your build produces NCover coverage files, then enter the location of the coverage result files on the Builder Configuration tab. Bamboo will then parse and display the NCover results when each build runs.

Jira Issues

The following lists the reported defects and enhancements that have been reported. If you encounter a defect, or if there is a feature that you'd like added to the builder, feel free to raise an issue at the Jira site, or drop me an email at piaross@gmail.com.

type key summary reporter status

Data cannot be retrieved due to an unexpected error.

View these issues in Jira

Version History

Version 2 (supports Bamboo 2.x)

Version

Date

Description

2.1.17

14 Dec 2009

Ensure that NCover processing is not performed if build was unsuccessful

2.1.16

12 Sep 2009

NANT-23 Include the class name in the MSTest output

2.1.15

3 Sep 2009

NANT-24 Ensure that arguments containing quotes get retained when commands are executed

2.1.13

5 Aug 2009

NANT-22 Ensure NCover parser is i18n compliant

2.1.11

8 Jul 2009

NANT-19 Included support for parsing MSTest result files

2.1.10

19 May 2009

NANT-18 Ensure environment variables are correctly parsed

2.1.9

18 Feb 2009

NANT-15 Include messages in the build log to indicate if tests were not found

2.1.8

12 Feb 2009

NANT-14 Fixed line rate appearing in incorrect format

2.1.7

5 Feb 2009

Removed XSL transformations for presenting MBUnit results for the time being

2.1.6

4 Feb 2009

Fixed NullPointerException which occurred when processing NUNit results. Updated presentation of errors/failures for MBUnit results

2.1.5

11 September 2008

Updated plugin to support Bamboo 2.1

2.1.4

29 July 2008

Interim fix to BAM-2933 to allow replacement of predefined environment variables. Further details here

2.1.3

7 July 2008

Ensure that default values don't overwrite entered configuration

2.1.2

19 June 2008

Fixed some parsing issues of NCover reports

2.1.1

17 June 2008

NANT-10 Added initial support for NCover results

2.1.0

8 June 2008

Updated code to use correct mechanism to retrieve working directory

2.0.9

27 May 2008

Added ability to set specific directory containing test results - this was causing problems for users with Perforce repositories

2.0.8

22 May 2008

NANT-9 Command Builder arguments were disappearing

2.0.7

17 May 2008

NANT-8 Included support for msbuild.exe

2.0.6

17 May 2008

Added a Command Builder that handles parsing of NUnit and MBUnit result files

2.0.5

16 May 2008

NANT-7 Included support for MBUnit results

Version 1 (Supports Bamboo 1.2.x)

Version

Date

Description

1.0.5

17 May 2008

NANT-8 Included support for msbuild.exe

1.0.4

21 April 2008

Added a new Script builder that handles parsing of NUnit results (this has also been included in 2.0.3

1.0.3

24 January 2008

NANT-4 Fixed test results directory being overridden on the Edit Configuration page

1.0.2

4 October 2007

NANT-3 Ensure Category and Categories elements are handled correctly

1.0.0

12 May 2007

Final version for submission

0.9.3

12 May 2007

Added a devenv builder

0.9.2

3 May 2007

NANT-1 Pass through 'BambooBuildLabel' property to NAnt

0.9.1

30 April 2007

Added support for parsing/displaying NUnit results

0.9.0

29 April 2007

Initial stable version

Screenshots

10 Comments

  1. Hi Ross,

    Good to see someone's looking at doing this! My biggest feature suggestion is that you pass through the build label as a property to NAnt so that projects can use this to create the correct dll version. We do this in CCNet, then projects can use NAnt's <asminfo> task to create the version number.

    If in doubt, also look at CCNet's Nant builder docs (http://confluence.public.thoughtworks.org/display/CCNET/NAnt+Task) .

    I'm not doing .NET right now but if you'd like to throw some ideas at me shoot me a mail (my email address is a link on my blog at http://www.mikebroberts.com/)

    Mike (ex- CCNet Project lead)

    1. Hi Mike, thanks for the suggestion, I'll definitely have a crack at including this feature!

      Cheers,

      Ross

      1. Just FYI, I've put up a new version that passes the build label in a 'BambooBuildLabel' parameter to NAnt.

        Cheers,

        Ross

  2. Excellent! Just what we've been looking for! At least the NUnit tests part, which brings me to a question. A request, actually.

    We use a custom builder that just calls VisualStudio's devenv.com app to do commandline builds. Is there any possible way the NUnit tests parser thingy could be utilized in non-Nant builds?

    It's easy enough to wrap our debug builds in Nant, but it would be cool to be able to use NUnit tests in arbitrary builds (with arbitrary builders.)

    Thanks for making this plugin! Extremely useful!

    1. Hi Matthew, thanks for your feedback and suggestion. The NUnit results parsing logic is invoked from the NAnt Builder itself, but I'd imagine it would be pretty easy to create a devenv Builder that would build the appropriate command line to execute and which would also locate and parse NUnit results in a similar manner to the NAnt Builder. I can have a crack at adding a devenv Builder and I'll let you know when I've got something that you can try out. Feel free to drop me a line at piaross at gmail dot com if you'd like to discuss it further.

      Cheers,

      Ross

  3. It might be just that I'm dumb, don't understand Ant/Nant paths, etc, but is there a way to include NUnit results files that are outside of the build root? I need to go up about three directories and back down into another tree to get the .xml our NUnit tests generate but I can't for the life of me figure out the syntax.

     I guess I could easily just have the build script copy it where I want it, but that seems less elegant to me, and you know, appearances count. (smile)

     Thanks! Love this plugin/functionality!

    1. Hi Matthew, I haven't extensively tested it, but you should be able to configure the test location to do what you want. The NAnt Builder uses the test results location with respect to the source directory (ie. where the code has been checked out to). However, if you specify a directory (instead of a specific NUnit xml file or even *.xml), then the builder will search for all .xml files residing in that directory. So, if you have '../../../test/results', then so long as that path is navigatable from the build source directory, the NAnt Builder should process all the .xml files in that directory.

      Cheers,

      Ross

  4. Ross,

    Where can I find sources of 2.1.5 version, because the last subversion activity is tagging 2.1.3?

    ------------------------------------------------------------------------
    r20673 | rrowe | 2008-07-07 11:13:35 +0200 (Mon, 07 Jul 2008) | 1 line
    Tagged 2.1.3 release of Bamboo NAnt plugin
    

    I would like to analyse the sources in order to make sure that after my fix for http://jira.atlassian.com/browse/BAM-3155 the plugin behaves correctly.

    Cheers,
    Lucas

    1. Hi Lucas, sorry, I'd forgotten to check my changes in. Everything is committed now, and I've moved the latest code back into the trunk folder (it was previously in branches/bamboo_2.0)

      Cheers,

      Ross

      1. No problem at all. I'll take a look at it. Thanks,
        Lucas