Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why would I want to continue to use Nant when MSBuild is available?

I have seen the prior questions and answers. In that one question, the original poster asked a followup question:

what are the compelling reasons to use msbuild? are there cons?

I didn't see the answer to that. I'd like to know the converse, too. What are the compelling features of Nant?

I think, for nant, cross-platform is big. For msbuild, it is the currency and integration with Visual Studio. Does this sound right? Anything else?

EDIT/Added: anyone have a feature list comparison? Someone said "nant has more features out of the box." Which ones?

Would it make sense to combine these projects, combine efforts so as to benefit mutually? Has anyone asked MS if they'd be willing to contribute msbuild to the community, like WiX? What are the chances?

EDIT2: I just found this prior discussion, not sure why I couldn't find it before.

like image 663
Cheeso Avatar asked Mar 28 '09 23:03

Cheeso


2 Answers

Nant has more features out of the box, but MSBuild has a much better fundamental structure (item metadata rocks) which makes it much easier to build reusable MSBuild scripts.

MSBuild takes a while to understand, but once you do it's very nice.

Learning materials:

  • Inside the Microsoft Build Engine: Using MSBuild and Team Foundation Build
    by Sayed Ibrahim Hashimi (Jan, 2009)
  • Deploying .NET Applications: Learning MSBuild and ClickOnce
    by Sayed Y. Hashimi (Sep, 2008)
like image 194
Konstantin Tarkus Avatar answered Sep 19 '22 17:09

Konstantin Tarkus


I simply find NAnt easier to use. I dare say this is partly due to my background in Ant, but I found building a NAnt file for Protocol Buffers to be a much simpler job than building an MSBuild file for MiscUtil. (Even now there are things in the MiscUtil build which I'd like to include but can't - it seems ridiculously hard to dump the output of a task to a text file, IIRC.) The concepts are simpler, and there seem to be fewer gotchas in terms of when file collections are evaluated etc.

I currently like using a setup which I previously thought was really silly - I use NAnt for my "main" build file, but invoke MSBuild to do the actual "compile my .NET project" step. The idea of having two build systems for the same project is abhorrent, but I basically don't treat the MSBuild part as a full build system - it's just an easy way of compiling, and I never need to manually examine the project file. (I only interact with it via Visual Studio.) I've been able to evolve my Protocol Buffers build very easily this way, and I doubt I'd have had the same experience if I'd used MSBuild.

Soon I'm going to try building it all with Mono (when 2.4 is released - until then there are showstoppers in gmcs) at which point we'll see how portable the strategy is...

like image 21
Jon Skeet Avatar answered Sep 20 '22 17:09

Jon Skeet