blob: e874e8d97badc08a68b3d02af6ec6cab6c2d52a2 [file] [log] [blame]
<html>
<head>
<title>.NET Tasks</title>
<link rel="stylesheet" type="text/css" href="../stylesheets/antmanual.css">
</head>
<h1>.NET tasks</h1>
<h2>Introduction</h2>
Ant support for .NET goes back to before .NET was released, and
continues to be expanded based on user demand. Users writing nothing but
a .NET application, may want to look at the .NET-based
<A href="http://nant.sourceforge.net/">NAnt</A> project, that supports
both the Microsoft and the Ximian managed <A
href="http://go-mono.com/">Mono</A> project's implementation of the
.NET framework.
<p>
Over time, the .NET tasks in Ant have tended to evolve to meet a few
limited needs. Firstly, developers working with complex deployment problems may
want to use ant to use the fairly advanced deployment tasks Ant ships
with. Secondly, anyone who has a cross-platform project can use these
tasks to cover the .NET side of the problem. Here, cross-platform can
mean more than just Java and .NET: the C++ tasks in the ant-contrib
project on sourceforge can be used with Ant to do native C++ and .NET
cross development if that is your need. Finally, Ant support for .NET
lets one automate .NET development under an automated build process,
such as AntHill or Cruise Control.
<p>
What this means is that the Ant tasks for .NET support do not get as
much rigorous use as the Java tools, and are evolving more slowly -that
includes the time for support calls to change. But as a consequence,
developers working on .NET support have more freedom to play around with
the code. It also means that the fairly unusual set of tasks supported
by ant enable a few interesting operations that can not be performed any
other way:
<ol>
<li>Integrating with a Java based SOAP Service -generating C# code from
the server's WSDL and running it against the server.
</li>
<li>Building and deploying a C#-based Web Service, then using the Apache
Axis tasks to create JUnit tests to call the endpoints.
<li>Patching .NET type libraries to work with more complex IDL than the
basic &lt;importtypelib&gt; wrapper around tlbimport supports. Hence the
disassembler and the reassembler.
</li>
</ol>
Needless to say, possible does not mean easy.
<A href="http://www.manning.com/hatcher/chap15.pdf">Chapter 15</A> of
Java Development with Ant covers the first of these, using the Ant1.5
version of the tasks. Going the other way -generating Java client
code and JUnit testcases is covered in
<A href="http://www.iseran.com/Steve/papers/interop/">The Wondrous curse
of Interop</A>. The final trick, IDL and Typelib abuse, is not
documented as we do not want to encourage such an ugly practice. It,
can, however, be done if absolutely necessary. The trick is a sequence
of &lt;importtypelib/&gt;, &lt;ildasm&gt;, &lt;replace&gt; and finally
&lt;ilasm&gt;.
<h2>Task List</h2>
<table border="0" >
<tr>
<td><a href="csc.html">Csc</a></td>
<td>Compiles C# code</td>
</tr>
<tr>
<td><a href="vbc.html">vbc</a></td>
<td>Compiles VB.Net code</td>
</tr>
<tr>
<td><a href="jsharp.html">jsharp</a></td>
<td>Compiles J# files</td>
</tr>
<tr>
<td><a href="ildasm.html">ildasm</a></td>
<td>Disassembles .NET executables and libraries</td>
</tr>
<tr>
<td><a href="ilasm.html">ilasm</a></td>
<td>Assembles .il files</td>
</tr>
<tr>
<td><a href="wsdltodotnet.html">WsdlToDotnet</a></td>
<td>Generates .NET code (C# or VB) from a WSDL file</td>
</tr>
<tr>
<td><a href="ImportTypelib.html">ImportTypelib</a></td>
<td>Imports a COM type library into .NET</td>
</tr>
</table>
<hr>
<h2> Change Log </h2>
<h4>Ant1.6</h4>
This revision goes along with NET 1.1, though there is no reason why
it should not work on other versions.
<p>
<ol>
<li>vbc task</li>
<li>jsharp task</li>
<li>mono support</li>
<li>ilasm</li>
<li>tlbimport</li>
<li>Reference filesets in the compiler tasks</li>
<li>definitions in the compiler tasks</li>
<li>multiple source filesets in the compiler tasks. If these are used, the
implicit fileset is disabled</li>
</ol>
The compile tasks: vbc, jsharp, and csc, all contain lots of common code
in a shared base class: if you can use one you should be able to use
another.
<h4>Ant 1.5</h4>
This revision goes along with NET 1.0 (SP1)
<ol>
<li>CSC: added filealign</li>
<li>CSC: added reference to office.dll</li>
<li>CSC: dependency checking! only if destFile is set!
<li>WsdlToDotnet written
</ol>
<h4>Version 0.4</h4>
This is the beta-2 revision of the tasks.
<ol>
<li>ILASM: pulled the owner attribute, added keyfile for giving binaries a strong name
(MD5 hash of the checksum)</li>
<li>CSC: added win32res , noConfig, utf8output, fullpaths</li>
<li>CSC: </li>
</ol>
<h4>Version 0.3</h4>
The changes here reflect Beta-1 of the dotnet SDK and experience of use in
more complex projects. This build does not work with the older SDK,
primarily because the automatic reference feature references libraries
only found in the new SDK version.
<p>
External changes</p>
<ul>
<li>Recursive inclusion of .cs and .il files</li>
<li>Documentation enhanced, includes examples and details of all parameters</li>
<li>The csc task automatically includes the common dotnet assemblies, so
there is no need to remember to refer to 'System.dll', 'System.Web.Services',
etc. This feature can be disabled by setting the 'includeDefaultReferences'
flag to false. </li>
<li> References can also be referred to using the ReferenceFiles parameter, which
is an ant path specification. The old 'references' string is still retained.</li>
<li> An 'extraoptions' attribute enables the build file to include any CSC options
which are not explicitly supported in the CSC task. </li>
</ul>
Internal changes
<ul>
<li>Some minor refactoring (move common code a method)</li>
<li>Application of Jedits JavaStyle task resulted in a major reshaping of
the codebase and the insertion of a blank line every second line. Significant
effort was required to revert some (but not all) changes.</li>
<li>Removed throws clause from methods which can't throw exception<hr>
<h2> Change Log </h2>
<h4>Ant1.6</h4>
This revision goes along with NET 1.1, though there is no reason why
it should not work on other versions.
<p>
<ol>
<li>vbc task</li>
<li>jsharp task</li>
<li>mono support</li>
<li>ilasm</li>
<li>tlbimport</li>
<li>Reference filesets in the compiler tasks</li>
<li>definitions in the compiler tasks</li>
<li>multiple source filesets in the compiler tasks. If these are used, the
implicit fileset is disabled</li>
</ol>
The compile tasks: vbc, jsharp, and csc, all contain lots of common code
in a shared base class: if you can use one you should be able to use
another.
<h4>Version 0.5</h4>
This revision goes along with NET 1.0 (SP1)
<ol>
<li>CSC: added filealign</li>
<li>CSC: added reference to office.dll</li>
<li>CSC: dependency checking! only if destFile is set!
<li>WsdlToDotnet written
</ol>
<h4>Version 0.4</h4>
This is the beta-2 revision of the tasks.
<ol>
<li>ILASM: pulled the owner attribute, added keyfile for giving binaries a strong name
(MD5 hash of the checksum)</li>
<li>CSC: added win32res , noConfig, utf8output, fullpaths</li>
<li>CSC: </li>
</ol>
<h4>Version 0.3</h4>
The changes here reflect Beta-1 of the dotnet SDK and experience of use in
more complex projects. This build does not work with the older SDK,
primarily because the automatic reference feature references libraries
only found in the new SDK version.
<p>
External changes</p>
<ul>
<li>Recursive inclusion of .cs and .il files</li>
<li>Documentation enhanced, includes examples and details of all parameters</li>
<li>The csc task automatically includes the common dotnet assemblies, so
there is no need to remember to refer to 'System.dll', 'System.Web.Services',
etc. This feature can be disabled by setting the 'includeDefaultReferences'
flag to false. </li>
<li> References can also be referred to using the ReferenceFiles parameter, which
is an ant path specification. The old 'references' string is still retained.</li>
<li> An 'extraoptions' attribute enables the build file to include any CSC options
which are not explicitly supported in the CSC task. </li>
</ul>
Internal changes
<ul>
<li>Some minor refactoring (move common code a method)</li>
<li>Application of Jedits JavaStyle task resulted in a major reshaping of
the codebase and the insertion of a blank line every second line. Significant
effort was required to revert some (but not all) changes.</li>
<li>Removed throws clause from methods which can't throw exceptions </li>
</ul>
The test harness has been expanded to include unicode source file
(the build works but the rest of the system has 'issues' with high unicode
package and method names)
<h4>Version 0.2</h4>
First public edition, added to the ant cvs tree. Tested on the PDC build of
the dotnet SDK only, and still immature. The command execution code was
refactored out into a 'NetCommand' class for re-use. The Ilasm task was added
at this time.
<h4>Version 0.1</h4>
Initial proof of concept; very rudimentary support for CSC only.
s </li>
</ul>
The test harness has been expanded to include unicode source file
(the build works but the rest of the system has 'issues' with high unicode
package and method names)
<h4>Version 0.2</h4>
First public edition, added to the ant cvs tree. Tested on the PDC build of
the dotnet SDK only, and still immature. The command execution code was
refactored out into a 'NetCommand' class for re-use. The Ilasm task was added
at this time.
<h4>Version 0.1</h4>
Initial proof of concept; very rudimentary support for CSC only.
<p align="center">Copyright &copy; 2000-2003 Apache Software Foundation. All rights
Reserved.</p>
</body>
</html>