Using the aspnet compiler is the simplest way and gets you access to all cl arguments which is not available on nant tasks. Not sure why it's so.
Here's what I do
<property name="aspnetcomplier" value="C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler.exe" />
<target name="deploy">
<mkdir dir="${output.dir}" />
<exec program="${aspnetcomplier}">
<arg value="-v" />
<arg value="/trunk" />
<arg value="-p" />
<arg value="${source.dir}\Root" />
<arg value="-f" />
<arg value="${output.dir}" />
</exec>
</target
Nothing complicated.Works like a charm.
P.S. Dont forget to do a iisreset /stop and /start
<target name="stop.iis" >
<servicecontroller action="Stop" service="w3svc" timeout="10000" verbose="true" />
</target>
<target name="start.iis" >
<servicecontroller action="Start" service="w3svc" timeout="10000" verbose="true" />
</target>