VS 2005 & NAnt Integration

 I ran into an issue today that was driving me crazy. I upgraded the version of Rhino Mocks (I love Rhino Mocks!). I thought it would be easy. Download the latest version and drop it into our \lib folder, re-build and “BAM, it’s just that easy”…or so I thought.

After I added the reference, my workstation built correctly and so did the other team members. But when Cruise Control tried to build the project, the build failed! I don’t like to be “the guy” who breaks the build. Since the build server uses the msbuild nant task and VS 2005 uses msbuild (and magic) there is a disconnect between the build processes and I’ve never been able to integrate Nant into VS 2005 in a way that didn’t make the team grumble.

I couldn’t take it anymore so I did some research and found a way to integrate NAnt with Visual Studio 2005. It still isn’t seamless, but I don’t hate it…yet. One gotcha I discovered, you’ll need to name your build file “default.build” for nant.exe to pick it up.

I still wasn’t able to figure out what was causing the build to break, but at least I didn’t check-in and break the rest of team.

Now if I could find a way to run a .cmd or .bat file from the Solution Explorer….GRRR!

Is there an easier way? Should I be using msbuild for my build scripts over nant?

posted @ Monday, January 08, 2007 4:41 PM

Print

Comments on this entry:

# re: VS 2005 & NAnt Integration

Left by Javier Lozano at 1/8/2007 9:54 PM
Gravatar

I say just use MSBuild. This way you're not going against the current when it comes to integrating with the IDE. For our CCNET server, I have it configured to call an MSBuild set of tasks that compiles, runs unit tests, checks coverage and builds IDE documentation.

To me it wasn't that one is better than the other. It was more of what works best with the main tool developer use (VS2005)?

Just my two cents.

# re: VS 2005 & NAnt Integration

Left by Nick Parker at 1/9/2007 11:39 AM
Gravatar

Unfortunately it looks like there hasn't been any development with NAntRunner and Visual Studio 2005. The only other tool you might look at is the NAnt Shell Extension (http://taschenorakel.de/mathias/nantmenu.en.html), however this will require you to break out into Explorer. If you want to go that route, you can use CoolCommands (http://weblogs.asp.net/gmilano/archive/2006/05/10/446010.aspx) to help open the correct directory from within the Solution Explorer.

# re: VS 2005 & NAnt Integration

Left by Ben Scheirman at 1/10/2007 9:26 AM
Gravatar

What don't you like about using the msbuild task? I'm thinking of going that route, however I just noticed a message on the NAnt mailing list that said (roughly)

"... the long awaited <solution> task support for Visual Studio 2005 has been added to the latest build..."

This was mid December, so I wonder how long until it gets integrated into a release. IMO it took them far too long to get to this point.

# re: VS 2005 & NAnt Integration

Left by Andrew Craze at 1/23/2007 3:01 PM
Gravatar

I worked with MSBuild back in the VS2003 days and found it extremely unreliable. It would sometimes hang in the middle of a build and leave an instance of VS running. After a few builds, the build server would have problems, since there were all these orphaned VS processes that needed to be killed.

Big, flakey, pain-in-the-butt.

# re: VS 2005 & NAnt Integration

Left by Tim Gifford at 1/29/2007 9:46 PM
Gravatar

I'm not the only one...

http://weblogs.asp.net/bsimser/archive/2006/12/08/msbuild-nant-nunit-mstest-and-frustration.aspx

# re: VS 2005 & NAnt Integration

Left by George Zabanah at 3/5/2008 9:01 PM
Gravatar

You can run a bat/cmd script from Solution Explorer - I did this a while ago (over a year ago). I was just as annoyed - because I needed to execute Nant scripts from VS2005. You can find out how to do this in my blog.

# re: VS 2005 & NAnt Integration

Left by George Zabanah at 3/6/2008 2:19 AM
Gravatar

Here is the link:

http://netthread.blogspot.com/2008/03/execute-cmdbat-from-vs2005_06.html

# re: VS 2005 & NAnt Integration

Left by Tim Gifford at 3/6/2008 2:42 PM
Gravatar

@George - I checked out your post and that is a great tip!

Thanks for sharing!

Comments have been closed on this topic.