Sample Nant Script
Created: 2 December 2005 Modified:Originally published on chrislynch.info website.
Here is a sample Nant script I used on my C# ASP.NET CMS project.
<?xml version="1.0" ?>
<project name="nant" default="modules">
<property name="nant.settings.currentframework" value="net-1.1" />
<property name="build.dir" value="build" />
<property name="build.debug" value="true" />
<property name="build.target" value="../html/bin" />
<tstamp property="build.date" pattern="yyyy MM dd HH:mm" verbose="true" />
<echo message="Perfect Recall Build."/>
<echo message="Using '${nant.settings.currentframework}' framework on '${nant.platform.name}' platform."/>
<delete dir="${build.dir}"/>
<mkdir dir="${build.dir}" />
<target name="core">
<csc target="library" nowarn="0618" debug="${build.debug}" output="${build.dir}/error.dll">
<sources failonempty="true">
<includes name="error/*.cs" />
</sources>
<references failonempty="false">
<includes name="${build.dir}/*.dll" />
</references>
</csc>
<csc target="library" nowarn="0618" debug="${build.debug}" output="${build.dir}/chris.lynch.dll">
<sources failonempty="true">
<includes name="chris.lynch/*.cs" />
</sources>
<references failonempty="false">
<includes name="${build.dir}/*.dll" />
</references>
</csc>
</target>
<target name="look" depends="core">
<csc target="library" nowarn="0618" debug="${build.debug}" output="${build.dir}/look.dll">
<sources failonempty="true">
<includes name="Look/*.cs" />
</sources>
<references failonempty="true">
<includes name="${build.dir}/*.dll" />
</references>
</csc>
</target>
<target name="category" depends="look">
<csc target="library" nowarn="0618" debug="${build.debug}" output="${build.dir}/category.dll">
<sources failonempty="true">
<includes name="category/*.cs" />
</sources>
<references failonempty="true">
<includes name="${build.dir}/*.dll" />
</references>
</csc>
</target>
<target name="modules" depends="category">
<csc target="library" nowarn="0618" debug="${build.debug}" output="${build.dir}/content.dll">
<sources failonempty="true">
<includes name="content/*.cs" />
</sources>
<references failonempty="true">
<includes name="${build.dir}/*.dll" />
</references>
</csc>
<csc target="library" nowarn="0618" debug="${build.debug}" output="${build.dir}/list.dll">
<sources failonempty="true">
<includes name="list/*.cs" />
</sources>
<references failonempty="true">
<includes name="${build.dir}/*.dll" />
</references>
</csc>
<csc target="library" nowarn="0618" debug="${build.debug}" output="${build.dir}/listvalue.dll">
<sources failonempty="true">
<includes name="ListValue/*.cs" />
</sources>
<references failonempty="true">
<includes name="${build.dir}/*.dll" />
</references>
</csc>
<csc target="library" nowarn="0618" debug="${build.debug}" output="${build.dir}/listattribute.dll">
<sources failonempty="true">
<includes name="ListAttribute/*.cs" />
</sources>
<references failonempty="true">
<includes name="${build.dir}/*.dll" />
</references>
</csc>
<csc target="library" nowarn="0618" debug="${build.debug}" output="${build.dir}/listattributevalue.dll">
<sources failonempty="true">
<includes name="ListAttributeValue/*.cs" />
</sources>
<references failonempty="true">
<includes name="${build.dir}/*.dll" />
</references>
</csc>
<csc target="library" nowarn="0618" debug="${build.debug}" output="${build.dir}/login.dll">
<sources failonempty="true">
<includes name="Login/*.cs" />
</sources>
<references failonempty="true">
<includes name="${build.dir}/*.dll" />
</references>
</csc>
<echo message="Copy files to ${build.target}."/>
<copy todir="${build.target}" overwrite="true">
<fileset basedir="${build.dir}">
<includes name="*.dll" />
</fileset>
</copy>
</target>
</project>