I have a problem where a target defined in an <include>d build file
isn't being found when I make it a dependency of a target in my main
build file, although the file appears to have been <include>d
successfully. The included build file is valid and runs correctly if I
use it alone using the -f command line option.

I've cut the build files down to the bare minimum, and can still
reproduce the problem. The files are shown below:

test.build (a project-specific build file):

<?xml version="1.0" encoding="utf-8" ?> 
<project        xmlns="http://hbosfs.com/DDC/DDCNAntSchema.xsd";
                        name="TestIncludeDirective"
                        default="OuterTarget">

        <include buildfile="include.build" verbose="true"
failonerror="true" />
        
        <target name="OuterTarget" depends="prepare">
                <echo message="Outer target ran successfully" />
        </target>

</project>


include.build (the included file, initialises department-wide settings):

<?xml version="1.0" encoding="utf-8" ?>
<project
xmlns="http://nant.sf.net/release/0.85-rc3/nantcontribandvault.xsd";
                 name="CommonProperties">

        <target name="prepare">
                <echo message="Preparations completed..." />
        </target>
                
</project>

The include file appears to be loaded okay, but Nant then fails with an
error indicating that the target "prepare" is unknown:

NAnt 0.85 (Build 0.85.2007.0; nightly; 30/06/2005)
Copyright (C) 2001-2005 Gerry Shaw
http://nant.sourceforge.net

Buildfile: file:///C:/brd/test.build
Target framework: Microsoft .NET Framework 1.1
Target(s) specified: OuterTarget

  [include] Including file C:\brd\include.build.

BUILD FAILED

Target 'prepare' does not exist in this project. It is used from target
'OuterTarget'.

Total time: 0 seconds.



I've tried both 0.85 RC 3 and the latest nightly (20050630), both
exhibit the same problem. I'm running on a WinXP box, working on my
local drive.

Any thoughts on this would be appreciated as its currently preventing me
from factoring out lots of department-wide variables into an included
build file used by all projects, meaning that my project specific
(outer) build file is needlessly verbose and difficult to maintain.


Cheers,

-Bruce


-- 
Bruce Davidson

-- 

------------------------------------------------------------------------------
HBOS plc, Registered in Scotland No. SC218813. Registered Office: The Mound, 
Edinburgh EH1 1YZ. HBOS plc is a holding company, subsidiaries of which are 
authorised and regulated by the Financial Services Authority.
==============================================================================



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Nant-users mailing list
Nant-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to