Adding IntelliSense to NAnt script edting

NAnt IntelliSense

Do you use NAnt to build your .NET project (say “yes”)? If so, have you memorized all the tags and attributes defined in the NAnt schema (say “no” even if you have). Do you know that cool IntelliSense thing in Visual Studio.NET (of course you do)? Well, you can have it while editing your NAnt build scripts. Interested (again, say “yes”)? Here’s how to do it:

  1. Copy the NAnt schema XSD from here (or from the NAnt download available here) to C:\Program Files\Microsoft Visual Studio 10.0\Xml\Schemas (or to whatever path where VS.NET is installed).
  2. Open your NAnt build script in Visual Studio.NET.
  3. Select the XML | Schemas… menu option.
  4. Click the Add… button and select the NAnt.xsd file that you copied in the first step.
  5. Add the xmlns=”http://nant.sf.net/release/0.91-alpha2/nant.xsd&#8221; attribute to the <project> tag in your NAnt build script, like this:
    <project name="project1" xmlns="http://nant.sf.net/release/0.91-alpha2/nant.xsd" default="build" basedir=".">
  6. Enjoy the IntelliSense goodness!

Now that you’ve added the NAnt schema to Visual Studio.NET, you can have IntelliSense on any NAnt build script simply by adding the xmlns=”http://nant.sf.net/release/0.91-alpha2/nant.xsd&#8221; attribute to the root <project> tag.

Enjoy!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s