Garren Smith

Getting to know the .net build tools

. 17 Sep 2009 - Johannesburg

I've recently been looking into using a build script to make building/testing my code easier. I've also wanted to implement a CI build server and using a build script makes it a lot easier to implement.
Small steps with Nant
I decided to first look at the tried and tested Nant build tool. Nant is a free build tool based on the Java Ant. The build script is a xml script that Nant then uses to build your project. I used the AutoMapper build script as an example. This along with the Nant wiki helped me to write a basic script that could compile my code, check some sql scripts out of SVN and rename a file for me. The script below is what I wrote.
Its not perfect and I'm not sure if I got all the naming of the tasks correct, however it did the job and I was quite happy with it as my first attempt.
Sharpening my Rake
I've been reading plenty of good reviews on using Rake as a build tool for .net projects, so I decided to try this as well. Rake is a build program written in Ruby. With a bit of help I downloaded IronRuby and installed Rake with it. I then read a nice intro on rake, I then used this example to copy my Nant script. This is what I ended up with:
The Analysis
Nant has been used a lot in .net projects and is definitely worth learning. I will definitley spend some more time and get a better understanding of it. However Rake is just so cool. Its really nice to use something that is easy to read, and very powerful as you can use Ruby to write custom methods and objects. Using IronRuby gives you the power to access all you .net code which definitely has its benefits. Its also just plain fun using a dynamic language.
I recommend all .net developers to give Rake a bash.
blog comments powered by Disqus
Fork me on GitHub