I've started to write some Ant tasks to improve Ant's .NET support even further (it already compiles C# or J# and does a couple of more development centric things). I started with a task that extends <exec> in a way that it should transparently invoke Mono if I point its executable attribute to my assembly on Linux - it still has some problems that are probably more due to Mono and my inexperience with it than with the task.

As a side effect and to test it, I've written <nant> and <msbuild> tasks that can invoke either build tool. So far only build file, targets and properties are supported, but I plan to support nested build file snippets in the future.

Right now you can use something like

  <nant buildfile="src/nant.build">
    <target name="echo"/>
    <property name="foo" value="bar"/>
  </nant>
but in the future one should be able to use
  <nant>
    <build>
      <nunit2>
        <test assemblyname="MyProject.Tests.dll"/>
      </nunit2>
    </build>
  </nant>
to invoke NAnt's <nunit2> task. Ant would create a temporary build file with the snippet and run NAnt on it.

The <msbuild> task is complete speculation as I don't have access to MSBuild at all (I've written the task only from reading the command line reference) and the <nant> task fails on Linux unless I install NAnt and all related assemblies (they are in my PATH) in /usr/local/bin - there must be something wrong here, setting MONO_PATH doesn't help either.

The code can be found in the proposal/sandbox/dotnet directory in Ant's CVS module. The top in WebCVS is here.

path: /en/Apache/Ant/dotnet | #