Could you provide more information? On which statement were you using an "if test"?
Use ${environment::variable-exists('name')} for testing environment variables. Use ${property::exists('name')} for testing NAnt properties. For example: <target name="test.target"> <echo message="Will not be echoed" if="${environment::variable-exists('test')}"/> <echo message="Will not be echoed" if="${property::exists('test')}"/> <echo message="Env variable does not exist" unless="${environment::variable-exists('test')}"/> <echo message="Prop does not exist" unless="${property::exists('test')}"/> <property name="test" value="true"/> <echo message="Will not be echoed" if="${environment::variable-exists('test')}"/> <echo message="Property exists" if="${property::exists('test')}"/> <echo message="Env variable does not exist" unless="${environment::variable-exists('test')}"/> <echo message="Will not be echoed" unless="${property::exists('test')}"/> </target> Gives: NAnt 0.85 (Build 0.85.2478.0; release; 14/10/2006) Copyright (C) 2001-2006 Gerry Shaw http://nant.sourceforge.net Buildfile: file:///C:/test.build Target framework: Microsoft .NET Framework 2.0 Target(s) specified: test.target test.target: [echo] Env variable does not exist [echo] Prop does not exist [echo] Property exists [echo] Env variable does not exist BUILD SUCCEEDED Total time: 0.3 seconds. Alex. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Schley Andrew Kutz Sent: Tuesday, June 03, 2008 5:57 PM To: nant-users@lists.sourceforge.net Subject: [NAnt-users] Bug discovered: The If and Unless tags evaluate afterproperties are checked for existence Ex. <!-- get the path to the nunit lib dir on the server (if it exists) --> <property name="compile.nunit.path" value="null" /> <if test="${environment::variable-exists('NUNIT_LIB_DIR')}"> <property name="compile.nunit.path" value="${environment::get-variable('NUNIT_LIB_DIR')}" if="${environment::variable-exists('NUNIT_LIB_DIR')}"/> </if> <!-- compile the main assembly --> <csc target="library" output="${build}/${proj.name.unix}-${proj.version}.test.dll" doc="${docs}/${proj.name.unix}-${proj.version}.test.xml" warninglevel="0"> <sources> <include name="src/**/*.cs" /> </sources> <references> <!-- if this is being run on a build server then reference the nunit files on the server, otherwise reference the files from the tools directory --> <include name="${compile.nunit.path}/*.dll" /> <include name="../../tools/nunit-2.5-alpha1/net-2.0/lib/*.dll"/> <include name="../../src/${proj.name}/${build}/${proj.name.unix}-$ {proj.version}.dll"/> </references> </csc> Notice my if statement. I *was* using an if test when setting the property and then when including it in the references block. However, NAnt kindly informed me that compile.nunit.path did not exist. Well, duh -- that is what I was checking. Apparently NAnt evaluates whether properties exist BEFORE it evaluates the IF and UNLESS expressions. I consider this to be a bug, but it may be by design... -- -a "condensing fact from the vapor of nuance" ------------------------------------------------------------------------ - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ NAnt-users mailing list NAnt-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nant-users ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ NAnt-users mailing list NAnt-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nant-users