Building a Build Server – Installing NAnt

In the previous article, we built a simple C# solution on our build server by directly calling MSBuild. It is possible to compose complex build processes by adding tasks directly to the Jenkins configuration and on a high level it is the correct process. However, if your needs have more specific decision making included, you will need a programming language to easily describe this. Also, having a source code describing your build process helps with being able to version control it.

Here comes NAnt into the picture. NAnt is a free build tool, like make or Ant. It uses an XML build file to describe a set of build processes with various targets.

The core installation of NAnt can be grabbed from the NAnt website, and there are additional build instruction available at the NAnt contrib website. As they are .NET programs and libraries, you should use the same version from both. We are going to use the 0.92 version for this installation.

Let’s first install wget into the Cygwin environment, because having the Cygwin tools helps us with easy installation from the command-line. This also helps with being able to provide much more accurate installation instructions.

Run the setup-x86_64.exe installer of Cygwin (downloaded during the installation of Git) and go to the package selection section, clicking Next until you reach it.

In the Select Packages section, search and set the following packages to be installed:

wget, unzip

If they are not showing up on the search result, make sure that the View combo box is set to Full. After selecting all the packages, click Next in the windows until the installation process reaches its end.

Downloading the files

Open Cygwin terminal and let’s grab NAnt packages and the streams package from SysInternals:

Unpacking Streams and installing it

The Streams utility is used to remove the restrictions on the zip files, coming from the fact that they have been downloaded from the Internet. If you don’t remove this restriction, the zip file will unpack without any problems, but the files unpacked will inherit this restriction. They when running NAnt later, it is going to crash, because the restrictions disallow to load the required DLLs for proper functioning. We are also going to install streams into the Cygwin environment, because this restriction problem is constantly coming up with files being downloaded from the Internet.


install -m 755 streams.exe /usr/bin

streams -accepteula

Installing NAnt

The following commands will unpack the already downloaded NAnt zip files and the place them into C:\NAnt.

streams -d

streams -d



cp nantcontrib-0.92/bin/* nant-0.92/bin

mkdir /cygdrive/c/NAnt

cp -r nant-0.92 /cygdrive/c/NAnt

rm -rf /tmp/nant

cd /cygdrive/c

icacls NAnt /T /Q /C /RESET

Configuring NAnt in Jenkins

From the main Jenkins webpage go to Manage Jenkins / Manage Plugins

On the Available tab enter NAnt in the Filter and select the NAnt Plugin.

Click on the Download now and install after restart button and tick Restart Jenkins when installation is complete and no jobs are running.

After Jenkins restarted, go to Manage Jenkins / Configure System and in the Nant Builder section add the following configuration:

Nant installation


NAnt 0.92



Save changes.

Check NAnt Installation

Go to the project page of the JenkinsHelloWorld project, and select Configure. This project has been created in the previous article.

In the Build section, remove the MSBuild build step and add the following:

Execute NAnt build

NAnt Version

NAnt 0.92

NAnt Build File




Save changes and execute the build by clicking on Build Now.

To verify the result, go to the project page of the JenkinsHelloWorld project, and the latest build should show a blue ball. Red ball indicates error. Either way, going into the console log of the build by hoovering on the build number and from the dropdown menu selecting Console Output will reveal more information. In case of success, near the end of the output the following should show up:


[echo] Hello World!


Please share this article, or leave a comment below if you have some useful information to add. Also, follow me by using the icons below, as in the next article we are going to package our library into a NuGet package and publish it via a private repository.

By subscribing to the email list, you will be notified about new posts.
No comments yet.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Powered by WordPress. Designed by WooThemes