I've begun following my advice on code generation with COG and NAnt more, and my
previous solutions involved having a shell open to run NAnt. I find this kind of annoying, and finally
took the 2 minutes to hook NAnt into visual studio. Here's how:
- Open VS.NET
- Choose Tools->External Tools
This menu lets you add a command line program to the Tools menu.
- Click Add, and fill in the information as follows:
Of course, have the command pointing to your NAnt install.
The "Use Output window" will prevent VS.NET from spawning a seperate command window, and the NAnt output will go into the VS output window.
The "Prompt for arguments" will throw up a dialog for you to add command line arguments, so you can specify a target if you want.
- Click OK, and now you have a Tools->nant menu item that will run nant.
Now that its in your tools menu, you can make a keyboard shortcut to it, or put it on a toolbar. Assigning it is kinda weird,
as VS has commands for "External Command 1", "External Command 2", etc, so you have to look at the tools menu to see what index your
"nant" entry is, and then assign your shortcut accordingly.
This will only work if you have your .build file in the same directory as the solution file. If you keep it in another place, click the arrow next to "Initial Directory" to see other options, and build your path from those.