Almost three years ago I started to experiment with improved support for .NET development int Ant. It started with support for NAnt and MSBuild - in theory by that time, since MSBuild wasn't available to me. Back then I started with more serious C# development on Mono and the real goal was to be able to drive the whole development of a mixed language project from within Ant.

It's first "micro-release" was more or less an attempt to store a snapshot of my work somewhere other than my hard disk - and strangely to me I received feedback pretty soon. It seemed I wasn't the only one crossing platform boundaries and wanting to stick with Ant.

About a year later, I added NUnit support, which was a real step forward for me since it allowed me to remove NAnt (as much as I liked it) from the build process completely. All development was happening using Mono on MacOS X by that time, I wasn't even sure it work on Microsoft platforms until Steve reported success.

When we started the Antlibs subproject, the .NET tasks were among the first to be added to the sandbox and among the first to be promoted from sandbox to proper. It probably was the first one to receive a bug report as well.

In the mean time I've switched jobs and Microsoft's .NET framework is the primary (but not sole) development platform during the day. This means that the MSBuild and wix tasks have now been tested and actually work.

It also means Mono isn't getting as much testing as I'd like. Yesterday we've released the first beta release of the Ant library, even though Gump says the wsdltodotnet tests are failing on Mono. This should be addressed before the final release, but more testers are not only welcome, you are severely needed.

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

I've just committed a new version of the Ant task for the WiX toolkit to Apache's subversion repo. The former version never worked since I forgot to add a few setters. I never claimed I had tested it anyway ;-)

This time it is tested and to prove it, I've added a target to Ant's own build file that uses it. If you have WiX and the .NET Antlib installed, you can now create an MSI installer package for it. No other software required.

This is how it looks:

    <dn:wix target="${msi.file}"
      mode="both" wixHome="${wix.home}" wixobjDestDir="${wixobj.dir}">
      <sources dir="src/etc" includes="*.wxs"/>
      <moresources dir="${dist.dir}"/>

      <candleParameter name="dist.dir" value="${dist.dir.resolved}"/>
      <candleParameter name="version" value="${manifest-version}"/>

This will create the MSI file using the .wxs descriptions in src/etc, skipping the task if the files in dist.dir haven't changed. The task combines candle and light but you can run them separately if you want to.

Writing the .wxs files turned out to be more cumbersome than I thought - in particular if you have several hundred HTML files of Javadocs to add. I'll have to sit down and write a task that does the equivalent of tallow (which isn't documented in the official manual, see this part of Gabor's excellent tutorial instead), but in a way that makes the resulting fragment more predictable (and valid, in the first place). I ended up running tallow and modifying the result manually.

I haven't even tried to create a UI for the MSI package, but it should be doable with the task as it is.

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

Last month the Antlib has been promoted to an official subproject of Ant, Steve and Conor are now committers to it as well. We still need to update the site, though. Gump builds it nightly and runs the tests (well, only the ones for dotnetexec) on Mono.

I finally found some time to try MSBuild and immediately found that the task didn't work (the argument is /target not /targets). Well, now it does:

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

$ ant -lib build/lib -f test.xml
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

This means, the MSBuild task now sort of officially works, I've updated the snapshot at and also provide a special version for Ant 1.6.x that is minimally limited as it won't support build snippets nested into the MSBuild task.

In fact, the "most recent" version I've uploaded will require a version of Ant's svn trunk not older than a few minutes since I had to teach Ant's DOMElementWriter some new tricks to make it support XML namespaces.

Those snapshots are only temporary, I'll come up with a release plan rather soon.

After my tests today, the NAnt, NUnit and dotnetexec tasks work reasonably well on Mono (tested on Linux and MacOS X) and Microsoft's .NET frameworks 1.1 and 2.0 - MSBuild requires Microsoft's 2.0. They could certainly use some more testing.

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

I've updated the jar file containing my Antlib of tasks that may be useful for people developing .NET applications with Ant. There is no new functionality, the old jar was missing a class that made it unusable with Ant 1.6.2.

Many thanks to Doug Case for letting me know.

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

I've spent some time on NUnit tests for the stuff I do at work and felt I really should write an <nunit> task for Ant so I don't have to shell out to a different build tool or use <exec>. Since most of the stuff I needed was already present in my experimental Ant library for .NET development, it wasn't too difficult.

The result is inside and the docs are either online or available as an archive.

All those tasks have only been developed and tested under Mono on Linux and MacOS X (1.0.1 highly recommended) or are completely untested - MSBuild (where does a mere mortal get it - would it run on Mono?) and WiX (doesn't work on Mono). Because of this, feedback by a Microsoft framework users would be extremely useful, but any feedback is appreciated, of course.

Update: Steve has successfully tested the library using the Microsoft .NET Framework 1.1.

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