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 NAntGenerateSchema.build 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="http://nant.sf.net/schemas/nant.xsd"/>
        </target>
    </
    project>

  • 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…:
    FileOpenExtraOptions

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

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

  • Repeat for all your build files. Done.

2 Comments

Comments have been disabled for this content.