In this case local.properties is a property itself defined in the line above
the if statement:

<property name="local.properties" value="${root.dir}\local.properties.xml"
/>
  <if test="${file::exists(local.properties)}">
    <echo message="Local properties file exists!" />
    <include buildfile="${path::get-full-path(local.properties)}" />
  </if>

I did however fix my problem. Turns out that I did not have an xmlns
attribute on my <project> element in local.properties.xml so it was not
loading the file. Previous versions of NAnt didn't care if there was an
xmlns there and I had only used it for intellisense in Visual Studio. When I
added that attribute, the file loads fine and the properties are now
available.

Sorry for trolling without investigating all possibilities!

- BF


On Mon, Dec 8, 2008 at 11:50 AM, Bob Archer <[EMAIL PROTECTED]> wrote:

>      <include buildfile="${path::get-full-path(local.properties)}" />
>
>
>
> Wouldn't you need a .xml here since that is your file name?
>
>
>
> BOb
>
>
>
>
>  ------------------------------
>
> *From:* Ben Floyd [mailto:[EMAIL PROTECTED]
> *Sent:* Monday, December 08, 2008 12:45 PM
> *To:* nant-users@lists.sourceforge.net
> *Subject:* [NAnt-users] Including properties from another build file
> incurrent build file
>
>
>
> I'm having a problem with the <include /> task trying to load a local
> properties file from a global properties file. The following build files
> should explain the problem:
>
> ===========================
> C:\Dev\project\ui\ui.build
> ===========================
> <? xml version="1.0" encoding="utf-8" ?>
> <project name="project.ui" basedir="." default="build" xmlns="
> http://nant.sf.net/release/0.86-beta1/nant.xsd";>
>   <property name="root.dir" value=".." />
>   <include buildfile="${root.dir}/properties.build" />
>
>   <target name="build" depends="init">
>        ... compile project etc etc ... this works just fine ...
>   </target>
>
>   <target name="dist" depends="build">
>     <echo message="Property is needed here: ${server.base}" />
>   </target>
> </project>
>
> ===========================
> C:\Dev\project\properties.build
> ===========================
> <?xml version="1.0" encoding="utf-8"?>
> <project name="global.properties" xmlns="
> http://nant.sf.net/release/0.86-beta1/nant.xsd";>
>   <property name="src.dir"
> value="${path::get-full-path(project::get-base-directory())}" />
>   <property name="build.dir"                    value="${src.dir}\build" />
>   <!-- Load local properties if it exists -->
>   <property name="local.properties"
> value="${root.dir}\local.properties.xml" />
>   <if test="${file::exists(local.properties)}">
>     <echo message="Local properties file exists!" />
>     <include buildfile="${path::get-full-path(local.properties)}" />
>   </if>
> </project>
>
> ===========================
> C:\Dev\project\local.properties.xml
> ===========================
> <?xml version="1.0" encoding="utf-8"?>
> <project name="local.properties" xmlns="
> http://nant.sf.net/release/0.86-beta1/nant.xsd";>
>   <property name="server.base" value="http://localhost:8080/server/"; />
> </project>
>
> ===========================
> BUILD OUTPUT - C:\Dev\project\ui>nant.exe -buildfile:ui.build -nologo dist
> ===========================
> Buildfile: file:///C:/Dev/project/ui/ui.build
> Target framework: Microsoft .NET Framework 3.5
> Target(s) specified: dist
>      [echo] Local properties file exists!
> init:
> compile.models:
> compile.views:
> compile.presenters:
> compile:
> build:
> dist:
>
> BUILD FAILED
>
> C:\Dev\project\ui\ui.build (46,8):
> Property evaluation failed.
> Expression: ${server.base}
>               ^^^^^^^^^^^
>     Property 'server.base' has not been set.
>
> Total time: 0.3 seconds.
>
> ===========================
>
> When running the ui build script, everything works until it needs to
> reference properties that are found in local.properties.xml. I reference
> properties that are defined in properties.build and those work just fine. I
> can't find anything on the nant website that would explain this problem. Any
> suggestions would be very welcome!
>
> Thank You,
> BF
>
------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to