Scott Hanselman

Intellisense and NAnt .build files in VS.NET

March 30, '04 Comments [9] Posted in Nant | XML
Sponsored By

This has been blogged about before here and there, but I wanted to share it as I had to mess with it yesterday. 

Getting Intellisquish to work with NAnt .build files in VS.NET:

  1. Copy this file: nant-current.xsd (101.06 KB) to 'C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Packages\schemas\xml' on your system.
  2. In your NAnt build file (I make my with the extension .build) include this xmlns attribute:

    <project default="all" basedir="." xmlns="http://nant.sf.net/schemas/nant-0.84.win32.net-1.0.xsd">

  3. When you File|Open your .build file, notice the TINY down arrow on the Open button.  Click it, go to Open With...

  4. In Open With, select HTML/XML Editor.  There you go, NAnt Build files with Intellisense. 

If anyone knows how to tell VS.NET to ALWAYS open .build files with the XML Editor (without messing up any other file types) tell me, and then we can skip steps 3 and 4.

There is also some nice stuff on MSDN about Authoring Custom XML Schemas for use in VS.NET.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web
Tuesday, March 30, 2004 8:38:06 PM UTC
Do steps 1 and 2, but then go download VSTweak (http://www.gotdotnet.com/Community/Workspaces/Workspace.aspx?id=b9330ea5-096d-45b7-8a5b-17450d7a0d5a). It allows you to add a custom extension (.build) and have it treated like it was a common extension (.xml). Then when you open .build files, it automatically throws them into the HTML/XML editor.
Tuesday, March 30, 2004 9:05:39 PM UTC
Click the "Set as Default" button in the "Open With" dialog.
Wednesday, March 31, 2004 12:32:53 AM UTC
What Chris said.
Sean Malloy
Wednesday, April 07, 2004 5:13:58 PM UTC
When I follow the steps above, I get squiggly lines below all my property elements; the tooltip says "The active schema does not support the element 'property'." All of my properties work correctly when running NAnt, however.

Anyone know why this is and how to fix it?
Friday, April 23, 2004 5:20:00 AM UTC
Same problem here, may someone help?
Jack
Thursday, August 19, 2004 2:38:22 PM UTC
It is very easy to create the schema file yourself...just create and run a simple build file as described on my Blog (http://dukeytoo.blogspot.com/2004/08/nant-schema-file-for-vss-2003.html).

(I tried to post it here in the comment, but ASPX compained about dangerous tags. I'm too lazy to escape them out, so...)
Thursday, August 19, 2004 8:23:55 PM UTC
I see you have already been told how to make it the default. Here is a posting from my Blog explaining the whole process.

http://objectsharp.com/Blogs/dave/archive/2004/06/04/575.aspx
Friday, January 14, 2005 4:05:16 PM UTC
The xsd for Nant is incorrect. (reason for squiggly lines). Inside of the project and target elements, it refers to an element properties of type nant:properties. I think the element name should be property in these two places (and possibly others).
Tim Wilson
Tuesday, January 31, 2006 11:29:01 PM UTC
Make sure if you have any nant include tasks that the included projects have the same namespace. If not you're likely to encounter an unlikely error: BUILD FAILED - Target 'foobar' does not exist in this project.

See details here:

http://dotnetbkm.blogspot.com/2006/01/nant-files-and-xml-namespaces.html
Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.