Home > Uncategorized > VS.NET Intellisense for .build files in NAnt

VS.NET Intellisense for .build files in NAnt

September 22nd, 2006 Leave a comment Go to comments

If you have ever worked with NAnt , you probably know that there is an xsd for .build files that provides intellisense in VS.NET 2003. After you add a task dll ( In my case NAnt.SharePoint.Task.dll) or install a newer version of NAnt , there are some manual steps required to make VS recognizes the new schema. Instead of the manual process, you can get NAnt itself to update/generate its schema for the internal use of VS.NET 2003 by creating a build file and calling the command line as described below:

1) Create UpdateCreateSchema.build file with the following NAnt snippet and save the file in for example c:
antGen folder :

 xml version=”1.0″ encoding=”utf-8″ ?>
<project name=”
UpdateCreateSchema default=”genschema”>
might be different in your installation–>

    <property name=”SchemaFile” value=”C:Program FilesMicrosoft Visual Studio .NET 2003Common7PackagesschemasxmlNAnt.xsd”/>
target name=”genschema”>
nantschema output=”${SchemaFile}” target-ns=”http://nant.sf.net/schemas/nant.xsd”/>

2) Assuming Nant has been properly added to Path variable, open a command prompt and change directory to c:
antGen . Call the following command line:

 nant file: UpdateCreateSchema.build

3) Now that you have deployed the latest version of NAnt.xsd file to the C:Program FilesMicrosoft Visual Studio .NET 2003Common7Packagesschemasxml folder , you must go through all of your build files in your project and

a.Make VS.NET recognize your .build file as an XML file (If already done, skip this step then ): 

In “Solution Explorer”, right-click a .build file and choose “Open With”. In the “Open With” dialog, select “HTML/XML Editor” and click the “Set as Default” button. Enable intellisense for each .build file.

b.When file is opened by the “HTML/XML Editor” , in the properties window , set the targetSchema to the newly updated/generated Nant.xsd

4) Boom. You’ll get intellisense. Enjoy!

Categories: Uncategorized Tags:
  1. No comments yet.