I love nAnt. It can do so many things for me and I can get it to do those things for me so very quickly. I do not like to leave the IDE, I try to keep the list of reasons for my leaving it short. To help me keep that list short while still getting nAnt to pull it weight I have integrated nAnt into the IDE through the external tools feature of VS.NET. This not a brainy thing. I bet plenty of people have done it. But I don’t see many and more people should. Take a look at how I use it. First I keep a scratch file as a solution item: Scratch.build.xml. I edit this file to do repetitive tasks for me.

While I have the scratch file in focus I execute the nAnt external tool.

To get nAnt to show up as an external tool configure a new external tool like so:

Some shops have self contained projects, meaning that everything the project needs to build is contained in its directory structure. I follow this practice so nAnt is located in the project environment not in my machine environment. This is important to note if you follow this practice too. How will VS.NET find the nAnt.exe. You don’t want to configure a path to a specific projects copy of nAnt. I use bat files to start my IDE.

This OpenSolution batch file will set the PATH to include nAnt.exe.
set PATH=%SystemRoot%system32;%SystemRoot%;%SystemRoot%System32Wbem;C:Program FilesSubversionbin;..BuildnAntbincall "C:Program FilesMicrosoft Visual Studio8VCvcvarsall.bat"devenv "Doubler.sln"
You may have noticed the RunScratch batch file as well. This for situations when you need to call devenv.exe from the nAnt script. For some reason it will not compile a lick from the commanline if the IDE is open. I don’t know why.
Something more we can do to make this easier is map a control key sequence to execute the nAnt script. All external tool entries have a VS.NET command. Look in the registry to find the external tool number. On my machine nAnt is 2.

I mapped mine to Ctrl+Shift+N.

Documentation…
Installation of CI Factory Documentation#Install Tailoring the Installer Documentation#Tailor Installing a New CI Server Documentation#Create New Server Adding a Package Documentation#Add Package Installation After downloading you will need……
June 3rd, 2006, at 1:18 pm #Install Document…
Installation of CI Factory Documentation#Install Tailoring the Installer Documentation#Tailor Installing a New CI Server Documentation#Create New Server Adding a Package Documentation#Add Package Installation After downloading you will……
June 4th, 2006, at 1:16 pm #[…] I have NAnt integrated into my IDE, VS.NET, with the external tools configuration and a key combo mapped to execute the command, Shift+Alt+N. This allows me to quickly edit and execute scripts. I also use CI Factory on most projects I am involved in. This magnifies how useful NAnt is in just getting stuff done for me. CI Factory includes many componetized NAnt targets and properties that are relevant to the solution you have open. This means that I can quickly call on those properties and targets to do work for me. As a build master I can quickly test and experiment with parts of the build scripts before publishing them to the build server. […]
January 19th, 2007, at 4:04 pm #I ran into some trouble with in attempting to set this up. The external tools list in the registry is 0 based and the external tools command list for keyboard shortcuts is 1 based.
In your example above, you should select Tools.ExternalCommand3 instead of Tools.ExternalCommand2 when mapping the keyboard shortcut.
This should be obvious since there is no Tools.ExternalCommand0, but it was not immediately obvious to me
January 2nd, 2008, at 3:01 pm #Hi,
this is a nice solution, but not flexible enough. I have a blog entry on how to leverage the same action with possibility to have a full command shell using VSCmdShell addin here http://weblogs.asp.net/sfeldman/archive/2008/01/02/nant-and-visual-studio-reporting-from-the-field-trip.aspx
and a short screen-captured video here http://video.msn.com/video.aspx?vid=e21b9eea-1fe0-4017-b4c2-e1febedbe6b9
Sean
January 3rd, 2008, at 8:35 pm #[…] Before I built this, though, I looked around to see if someone had beaten me to the punch. I found a couple of plug-ins for Visual Studio (Jay Flowers‘ Studio hack and the Sharp Builder toolset) which would do basically what NAntRunner does, except from within the IDE. Why did I want a standalone interface, separate from Visual Studio? I am in the process of moving my company to automating our builds with CruiseControl, and NAnt is going to be a key piece to the overall solution. Several of our projects are not .NET, and therefore not in Visual Studio, so an IDE plug-in just wouldn’t be useful or appropriate across the board. […]
May 21st, 2008, at 1:04 am #