grack.com

I was playing around with getting NAnt to build all of our VS.NET projects today - it’s much more pleasant to build 90+ C# projects using an XML-based build script than with VS.NET’s native build system.  I highly recommend anyone with more than a few dozen projects to consider using it!

It’s a bit of a pain to get around some of the VS.NET locking issues, but once you’ve got it figured out, you’ll be thankful.

The trick is to create a number of empty C# projects with a “pre-build” step that runs NAnt.  It’s easier if you create a new solution configuration named “NAnt” based off the “Release” solution configuration.  This is the important part.  If you create the solution configuration based off the “Debug” configuration, VS.NET’s Intellisense engine will end up locking the files that NAnt is trying to build.  Basing it off the Release configuration allows VS.NET to use the set of DLLs in the bin/Release/ directory, while NAnt builds to your bin/Debug/ directory. 

You may need to build the full bin/Release/ configuration on occasion if you do a lot of designer-based editing.  VS.NET will be looking for DLLs in the bin/Release/ directory and, if it doesn’t find them, the designer will bomb out.  Don’t forget to rebuild the Release configuration if you make changes that need to show up on the designer side.

Note that I’m assuming you’re using the NAnt task to build.  If you’ve got a build file set up with manual tasks, you’ve probably got different output directories anyway and the above is moot.  :)

Another benefit - it’s about 50 times faster (no kidding) to open/close the solution when all of the C# projects are disabled.  VS.NET is clearly not designed for anything more than a couple dozen projects.

Read full post