NAnt intellisense in VS.NET 2003

I know, a zillion people wrote about intellisense in VS.NET for NAnt files already, but just as a reminder for myself I write this blog entry:

  • Create a file with the following NAnt code, modify the SchemaFile property for your installation diretory/version of VS.NET:

    <?xml version="1.0" encoding="utf-8" ?>
    <project name="GenerateNAntSchemaForVS.NET" default="genschema">
        <property name="SchemaFile" value="C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Packages\schemas\xml\NAnt.xsd"/>
        <target name="genschema">
            <nantschema output="${SchemaFile}" target-ns=""/>

  • Call this script each time you add some extra tasks dll’s or when you move to a new version of NAnt, because it generates a schema based on the available NAnt tasks.

  • Add you NAnt build file to your VS.NET project (if possible).

  • Open the .build file in VS.NET using File->Open…->File…, and then notice the extra options in the lower right corner of the open file window, select Open With…:

  • Now select to open this file as selected below, also click Set as Default:

  • Set in the properties window for this file the targetSchema to the NAnt schema:

  • Repeat for all your build files. Done.


Comments have been disabled for this content.