Intellisense for NAnt Build Files (VS 2005 and 2008)
2010 January 17

Step 1. Make VS recognize a .build file as an XML file.
- Right-click a .build file in the “Solution Explorer” and select “Open With …”
- In the “Open With” dialog, select “XML Editor” and “Set as Default”

Step 2: Enable intellisense for .build files.
Get the schema file for NAnt:
- Version 0.86 Beta 1 is at http://nant.sf.net/release/0.86-beta1/nant.xsd
- Version 0.85 is at http://nant.sf.net/release/0.85/nant.xsd
Copy it to the “xml\Schemas” subdirectory of your VS installation:
- Note that you can check this path via Tools > Options > Text Editor > XML > Miscellaneous

Specify the schema to use within Visual Studio:
- Open the file so that it appears in a Visual Studio editor window.
- Click the file’s editor window (to activate it) and specify the schema to use (within the “Properties” window).

- Note that this dialog has changed from VS 2005 to 2008:

(VS 2005)

(VS 2008)
If all of that is not enough, make sure to enter an xmlns and make sure it is equal to the xmlns specified in the XSD schema.
!!!!! Even though the schema is available at http://nant.sf.net/release/0.86-beta1/nant.xsd and http://nant.sourceforge.net/release/0.86-beta1/nant.xsd, you must reference the former url in your build file because it is the one referenced in nant.xsd. !!!!!
Here is an example of what I mean:
<?xml version="1.0" ?> <project xmlns="http://nant.sf.net/release/0.86-beta1/nant.xsd" name="MyProject"> <!-- stuff here --> </project>
Hope that helps someone. Happy Programming!
