<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Language" content="en-ca" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="description" content="Running NAnt" /> <link rel="stylesheet" type="text/css" href="../style.css" /> <title>NAnt - Running NAnt</title> </head> <body> <table width="100%" border="0" cellspacing="0" cellpadding="2" class="NavBar"> <tr> <td class="NavBar-Cell"> <a title="NAnt home page" href="http://nant.sourceforge.net"><b>NAnt</b></a> <img src="../images/arrow.gif" alt="->" width="13" height="9" /> <a href="../index.html">Help</a> <img alt="->" src="../images/arrow.gif" /> <a href="index.html"> Fundamentals</a> <img height="9" alt="->" src="../images/arrow.gif" width="13" /> Running NAnt </td> <td class="NavBar-Cell" align="right"> v0.91 </td> </tr> </table> <h1>Running NAnt</h1> <p> Running NAnt is simple once you have it <a href="../introduction/fog0000000013.html"> installed</a>, just type <code>NAnt</code>. Type <code style="whitespace: nowrap;"> NAnt -help</code> to get usage information.</p> <h3>Specifying the Build File</h3> <p> When nothing is specified, NAnt looks for a file ending with <code>.build</code>, e.g., <code>NAnt.build</code>, in the current directory. If found, it uses that file as the build file. If more than one file is found you need to specify the build file using the <code>-buildfile</code> option (see below).</p> <p> If you use the <code>-find</code> option, NAnt will search for a build file in the parent directory, and so on, until the root of the file system has been reached. To make NAnt use another build file, use the command-line option -buildfile:<em>file</em>, where <em>file</em> is the build file you want to use.</p> <h3>Specifying Targets</h3> <p> You can specify one or more targets that should be executed. When omitted, the target that is specified in the <code>default</code> attribute of the <code><project></code> tag is used.</p> <p> The <code>-projecthelp</code> option prints out the description of the project, if it exists, followed by a list of the project's targets. First those with a description, then those without one.</p> <h3>Setting Properties</h3> <p> To override properties specified in the build file use the <code style="whitespace: nowrap;"> -D:<i>property</i>=<i>value</i></code> option, where <i>property</i> is the name of the property, and <i>value</i> is the value for that property. </p> <h3>Examples</h3> <blockquote dir="ltr" style="MARGIN-RIGHT: 0px"> <div> <pre>NAnt</pre> </div> </blockquote> <p> Runs NAnt using the file ending in <code>*.build.xml</code> file in the current directory, on the default target.</p> <blockquote dir="ltr" style="MARGIN-RIGHT: 0px"> <div> <pre>NAnt -buildfile:..\ProjectName.build</pre> </div> </blockquote> <p> Runs NAnt using the <code>ProjectName.build</code> file in the parent directory, on the default target.</p> <blockquote dir="ltr" style="MARGIN-RIGHT: 0px"> <div> <pre>NAnt clean</pre> </div> </blockquote> <p> Runs NAnt using the default build file in the current directory, on a target called <code>clean</code>.</p> <blockquote dir="ltr" style="MARGIN-RIGHT: 0px"> <div> <pre>NAnt -D:debug=false clean dist</pre> </div> </blockquote> <p> Runs NAnt using the default build file in the current directory, first on the <code>clean</code> target and then on the <code>dist</code> target while setting the <code>debug</code> property to <code>false</code>. This could, for example, make a release distribution from scratch.</p> </body> </html>