How do I tell nant to only call csc when there are cs files in to compile?
- by rob_g
In my NAnt script I have a compile target that calls csc. Currently it fails because no inputs are specified:
<target name="compile">
<csc
target="library"
output="${umbraco.bin.dir}\Mammoth.${project::get-name()}.dll">
<sources>
<include name="project/*.cs" />
</sources>
<references>
</references>
</csc>
</target>
How do I tell NAnt to not execute the csc task if there are no CS files? I read about the 'if' attribute but am unsure what expression to use with it, as ${file::exists('*.cs')} does not work.
The build script is a template for Umbraco (a CMS) projects and may or may not ever have .cs source files in the project. Ideally I would like to not have developers need to remember to modify the NAnt script to include the compile task when .cs files are added to the project (or exclude it when all .cs files are removed).