# Dotnet Ant Library

## Introduction

This is a library of Ant tasks that support using .NET executables accross different platforms and in particular support using common .NET development tools like NAnt or NUnit from within Ant.

## Requirements

The current version requires Ant 1.6.2 or later and may even work better for a CVS build of Ant created from CVS HEAD.

## Where is it?

The source code for the library currently lives in the developer sandbox in Ant's CVS - http://cvs.apache.org/viewcvs.cgi/ant/proposal/sandbox/dotnet/. A binary can be found at http://cvs.apache.org/~bodewig/dotnet/dotnet.jar. A zip file containing the docs is also available.

Note that these are temporary locations and may change later.

## Feedback

Right now direct any feedback either directly to me or the Ant developer list.

## Installation

If you are building this from sources, run the antlib target and you'll get a file `dotnet.jar`. If you've downloaded `dotnet.jar`, you are already ready.

There are several ways to use the tasks:

- The traditional way:

                <taskdef
                  resource="org/apache/tools/ant/taskdefs/optional/dotnet/antlib.xml">
                  <classpath>
                    <pathelement location="YOUR-PATH-TO/dotnet.jar"/>
                  </classpath>
                </taskdef>

  With this you can use the tasks like plain Ant tasks, they'll live in the default namespace. I.e. if you can run <exec> without any namespace prefix, you can do so for <dotnetexec> as well.
- Similar, but assigning a namespace URI

                <taskdef
                  uri="antlib:org.apache.tools.ant.taskdefs.optional.dotnet"
                  resource="org/apache/tools/ant/taskdefs/optional/dotnet/antlib.xml">
                  <classpath>
                    <pathelement location="YOUR-PATH-TO/dotnet.jar"/>
                  </classpath>
                </taskdef>

  This puts you task into a separate namespace than Ant's namespace. You would use the tasks like

                <project
                  xmlns:dn="antlib:org.apache.tools.ant.taskdefs.optional.dotnet"
                  xmlns="antlib:org.apache.tools.ant">
                  ...
                  <dn:nant>
                    <dn:target name="my-target"/>
                  </dn:nant>

  or

                <nant xmlns="antlib:org.apache.tools.ant.taskdefs.optional.dotnet">
                  <target name="my-target"/>
                </nant>

  or a variation thereof.
- Using Ant's autodiscovery. Place `dotnet.jar` into a directory and use `ant -lib DIR-CONTAINING-THE-JAR` or copy it into `ANT_HOME/lib` - and then in your build file, simply declare the namespace on the `project` tag:

                <project
                  xmlns:dn="antlib:org.apache.tools.ant.taskdefs.optional.dotnet"
                  xmlns="antlib:org.apache.tools.ant">

  And all tasks of this library will automatically be available in the `dn` namespace without any `taskdef`.

## Tasks

- dotnetexec - run a .NET assembly that's in your PATH. You can chose the framework that is going to be used - defaults to Mono on non-Windows platforms and Microsoft's on Windows.
- nant - execute the NAnt build tool.
- msbuild - execute the MSBuild build tool, untested.
- wix - execute the WiX toolset, untested.
- nunit - execute the nunit-console.exe NUnit test runner.

Copyright © 2003-2004 The Apache Software Foundation. All rights Reserved.