Apache Ant site Apache Ant logo

the Apache Ant site

Apache .NET Ant Library

Apache .NET Ant Library™

The Apache .NET Antlib provides tasks that support development of .NET software with Apache Ant.

Apache .NET Ant Library 1.1

February 4, 2011 - Apache .NET Ant Library 1.1 Available

Apache .NET Ant Library 1.1 is now available for download as binary or source release.

This release fixes a few bugs and adds new tasks for the F# compiler and the tallow tool of the WiX toolkit.


This library doesn't strive to replace NAnt or MSBuild, its main purpose is to help those of us who work on projects crossing platform boundaries. With this library you can use Ant to build and test the Java as well as the .NET parts of your project.

This library provides a special version of the <exec> task tailored to run .NET executables. On Windows it will assume the Microsoft framework is around and run the executable directly, while it will invoke Mono on any other platform. Of course you can override these assumptions.

Based on this a few tasks to run well known .NET utilities from within Ant are provided, namely tasks to run NUnit, NAnt, MSBuild and the Wix toolkit.

The initial .NET tasks of Ant (compiler tasks for C#, J# and VB.NET for example) have also been moved to this Antlib and will see further development here.



Runs a .NET executable.


Runs NUnit tests.


Invokes NAnt, either on an external file or a build file snippet contained inside your Ant build file.


Invokes MSBuild, either on an external file or a build file snippet contained inside your Ant build file.


Invokes the candle and light executables of the WiX toolkit in order to create MSI installers from within Ant.



<project xmlns:dn="antlib:org.apache.ant.dotnet">
      <echo message="Hello world"/>

runs NAnt on the embedded <echo> task, output looks like

Buildfile: test.xml
[dn:nant] NAnt 0.85 (Build 0.85.1932.0; rc3; 16.04.2005)
[dn:nant] Copyright (C) 2001-2005 Gerry Shaw
[dn:nant] http://nant.sourceforge.net
[dn:nant] Buildfile: file:///c:/DOKUME~1/STEFAN~1.BOD/LOKALE~1/Temp/build1058451555.xml
[dn:nant] Target framework: Microsoft .NET Framework 1.1
[dn:nant]      [echo] Hello world
[dn:nant] Total time: 0.2 seconds.

Total time: 2 seconds


<project xmlns:dn="antlib:org.apache.ant.dotnet">
      <Message Text="Hello world"

runs MSBuild on the embedded <Message> task, output looks like

Buildfile: test.xml
[dn:msbuild] Microsoft (R) Build Engine Version 2.0.50727.42
[dn:msbuild] [Microsoft .NET Framework, Version 2.0.50727.42]
[dn:msbuild] Copyright (C) Microsoft Corporation 2005. All rights reserved.

[dn:msbuild] Build started 15.12.2005 20:21:56.
[dn:msbuild] __________________________________________________
[dn:msbuild] Project "c:\Dokumente und Einstellungen\stefan.bodewig\Lokale Einstellungen\Temp\build1543310185.xml" (default targets):

[dn:msbuild] Target generated-by-ant:
[dn:msbuild]     Hello world

[dn:msbuild] Build succeeded.
[dn:msbuild]     0 Warning(s)
[dn:msbuild]     0 Error(s)

[dn:msbuild] Time Elapsed 00:00:00.10

Total time: 0 seconds