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