« J2MEUnit in 10 minutes | Main | Palm .pdb files vs. .Net's .pdb files »

February 19, 2005

Using Visual Studio.Net to edit NAnt build files

I got my Visual Studio.Net to offer me intellisense help while editing NAnt build files as seen below:

IntellisenseWithNant.JPG

I was tired of referring to NAnt's documentation all the time. When I edited Ant files in Eclipse, I got intellisense help without even asking for it. I wanted Visual Studio to do the same. However, I had to do some work to get it to work. Actually, it is very simple. Here are the instructions to get it to work:

1. Find where NAnt is installed. Copy the nant.xsd schema file found in NANT_INSTALL_DIR\schema to C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Packages\schemas\xml folder. The later is a standard folder where Visual Studio.Net looks for schemas.

2. Open the nant.xsd file and see how the namespace is defined. In my case, it is defined as http://nant.sf.net/release/0.85-rc2/nant.xsd.

3. If you already have a build file, edit your build file's project tag to have a reference to this namespace. For e.g. my build file's project tag is shown below:

<project default="complete_install" basedir="." xmlns="http://nant.sf.net/release/0.85-rc2/nant.xsd">
....
</project>

Close the file now.

If you are creating a new build file, add the project tag as shown above and close the file.

4. Now Visual Studio is ready to offer intellisense help with build files. Select the build file in solution explorer. Right click and select open with. A dialog box opens up, select the HTML/XML Editor from the options and click the open button.

Now start using intellisense....

Posted by gunjan at February 19, 2005 02:39 AM

Comments

I think u missed out a point:-
Merge this registry entry:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1\Editors\{C76D83F8-A489-11D0-8195-00A0C91BBEE3}\Extensions]
"build"=dword:00000028


Posted by: Sajith Kumar at February 2, 2006 04:38 AM

Great!

Posted by: Ralf at March 1, 2006 08:55 AM

Thanks Gunjan!
A clear and precise cookbook,
and it works out of the box :)
Best regards
allan

Posted by: Allan at March 18, 2006 03:41 AM

Post a comment




Remember Me?

(you may use HTML tags for style)