Ok, so this sounds like it should be drop dead simple and it is, however it is not (at least to me) 100% intuitive how you could accomplish this.
Here is what I wanted to do. I wanted to be able to copy ALL of my compiled dlls from my build to a ‘staging’ location and I wanted to do this in a simple manor. The first thing I did of course was to jump out to the nant project page to refresh my memory on the <copy> feature. Sadly after reading the doc, i did not find anything that stuck out and said ‘hey, if you need to copy an entire folder structure do this’.
However, with a bit of googling I was able to figure out a simple way to do it.
<target name="copy.nightlyBuild.to.staging.location">
<property name="dir.nightlyBuild.destination" value="C:\NightlyBuilds_Output\Build" />
<mkdir dir="${dir.nightlyBuild.destination}" if="${not(directory::exists(dir.nightlyBuild.destination))}" />
<copy todir="${dir.nightlyBuild.destination}" includeemptydirs="true" overwrite="true" verbose="true">
<fileset basedir=".\SOME_FOLDER_TO_COPY_FROM">
<include name="**/*.*" />
</fileset>
</copy>
</target>
What makes this process work is the **\*.* in the include section. the **\ tells nant to do a recursive copy.
Hope this helps
Till next time,
Posted
07-07-2009 10:43 AM
by
Derik Whittaker