Tip: Editing nAnt files in Visual Studio
I used to think that opening nAnt files in Visual Studio was a lot of wasted overhead and not worth it. But I've realized that the auto-completion and IntelliSense features make it very worthwhile... so... here is how you setup Visual Studio 2005 to edit nAnt files.
-
Go to the directory where you installed nAnt. In the schema subdirectory is nant.xsd.
-
Copy this file into the Visual Studio 8\XML\Schemas folder.
-
Open Visual Studio. Open a project.
-
From the menu Project > Add New Item…
-
Select the template for an XML File. Give the file a .build extension.
-
If the new file isn't already opened, go to the Solution Explorer and open it.
-
Click somewhere in the opened .build file.
-
Look at the pane that shows the properties for the file. One of the properties is Schemas. Click the … browse button and locate the nant.xsd file and check the box next to it.
Now you will be able to use the IntelliSense features of Visual Studio to see schema errors, syntax errors, and get auto-completion of your elements.
Special note... there is a bit of odd behavior that you might notice. I discovered that if I clicked on the .build file in the Solution Explorer, the properties tab would change and I would no longer see the Schemas field, BUT if you then click inside the editing window for the .build file, the Schemas field reappears. Just some weird behavior from VS... 