Lucio Assis wrote:
> I think I found a bug related to the <include> task. Check out this
> very simple example:
>   
It's not a bug, it's the way XML works (without making NAnt jump through 
hoops).
> [default.build]
> <?xml version="1.0"?>
> <project name="whatever" default="testit"
> xmlns="http://nant.sf.net/release/0.85-rc4/nant.xsd";>
>   
By including this here, XML treats the default namespace as 
http://nant.sf.net/release/0.85-rc4/nant.xsd.  NAnt is smart enough to 
accept this (whatever the actual namespace spec is), and expect that its 
elements will be in that namespace.
>       <property name="p01" value="I'm in default.build" />
>   
So, for example, at this point NAnt is actually seeing
       "http://nant.sf.net/release/0.85-rc4/nant.xsd":property

as the fully qualified name of the task.  (I hope my abuse of the syntax 
conveys my intent clearly.)
> ...
> </project>
>
> [local.xml]
> <?xml version="1.0"?>
> <properties>
>       <property name="p01" value="I'm in local.xml" />
>   
At this point, NAnt effectively sees:

    "":property

as the fully qualified name of the element.  In XML terms, this is a 
different element name than 
"http://nant.sf.net/release/0.85-rc4/nant.xsd":property.  It is 
appropriate for NAnt to treat only one of these as the real property 
task, and the other is some unrecognized element that it should ignore 
(since it's not in the namespace for NAnt elements).
> It so happens that if I remove the xmlns attribute of the <project> element
> (i.e. <project name="whatever" default="testit">)
> it works as you'd expect it to:
>   
Conversely, if you add the xmlns to the <properties> element in 
local.xml, it should also work.
> Having the xmlns helps because Visual Studio uses that piece of
> information to provide Intellisense for NAnt build files, once you put
> nant.xsd in the proper location, but... I'm working without it for the
> moment.
>   
This, of course, is another good reason for adding the xmlns to 
local.xml.  After all, you may as well have Intellisense working for all 
of your build files, not just the top level.

Gary



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to