Search code examples
msbuildbuild-processrakenant

Reasons to use Rake over NAnt or MSBuild


I've seen several .NET projects (e.g. FluentNHibernate) use Ruby's rake to run their build, rather than using .Net tools, such as NAnt or MSBuild. What is the advantage to doing this? We're in the process of starting a new project and are trying to figure out whether to stick with our existing NAnt build or to migrate to something else. Any advice would be appreciated.

We're using .Net 3.5 if it makes a difference.


Solution

  • I can't speak to Rake as I've never used it, but I've used SCons, which I assume is the same thing as Rake but in Python.

    The main advantage of script-based make tools is that the build file(s) are in fact executable scripts. In other words, in Rake a build file is a Ruby script, and in SCons it's a Python script. If you can code something in the language the build system supports, you can do it at build time. So the flexibility there is essentially unlimited. Compare that to NAnt, where the build file is a series of instructions and declarations in XML. Sure, you can embed scripts and whatnot inside a NAnt build file, but you're still stuck with the flow, procedure and syntax of the language used to express the tasks.

    Then there's also the learning curve. NAnt is relatively simple, but if you're a C# developer who's never seen a build file, it can be a bit overwhelming at first. If you're a Ruby developer to begin with and you pick Rake, the learning curve is far less steep.

    I've never run into something NAnt couldn't handle, although I will admit some edge things tend to be difficult. If I used SCons they would have been far easier if I had the option of writing a Python script (with access to the excellent Python standard lib) to begin with.