Monday, April 07, 2008

Using IntelliSense with Nant Files in Visual Studio 2005

I've been hacking at some build files to integrate with CruiseControl.Net lately. I finally took the time to research how to have intellisense with the build files in Visual Studio 2005. It's easy - really.

1. Copy the Nant.xsd file into Visual Studio's Schema directory:

copy C:\opt\nant\nant-0.85\schema\nant.xsd "C:\Program Files\Microsoft Visual Studio 8\Xml\Schemas"

2. Look at the Nant.xsd to copy the namespace into your build files.
Inside my version of Nant.xsd the second line was:

<xs:schema xmlns:nant="" elementFormDefault="qualified" targetNamespace="" xmlns:xs="">

So I added the namespace to the "project" element of my build file.

<project name="Scythe" basedir="." xmlns="">

If you haven't already set your build file to be XML you need to right-click on the build file, select "Open With...", and use "XML Editor".
Now intellisense gives me hints on what I can put in the nant file.

No comments: