How do I go about compiling a .net 3.5 class library into a dll with Nant (0.86)?
This is what I have so far:
How do I go about referencing a system dll in the GAC? This line done seem to work.
<include name="System.ComponentModel.DataAnnotations.dll"/>
This is my script:
<?xml version="1.0"?>
<project name="MyCorp.Data" default="all">
<property name="debug" value="true" />
<target name="all"/>
<target name="clean" description="remove all build products">
<delete dir="build" if="${directory::exists('build')}" />
</target>
<target name="init">
<mkdir dir="build" />
</target>
<target name="compile"
depends="init"
description="compiles the application">
<csc target="library" output="build\${project::get-name()}.dll" debug="${debug}">
<sources>
<include name="src\MyCorp.Data\**\*.cs" />
</sources>
<references>
<include name="tools\subsonic\subsonic.dll"/>
<include name="lib\log4net\log4net.dll"/>
<include name="System.ComponentModel.DataAnnotations.dll"/>
</references>
</csc>
</target>
</project>
I got this far by using JP Boodhoos post
You can’t reference DLLs in the GAC using NAnt (that I know of), you need to have the physical DLL somewhere (e.g. in your project lib folder) and reference it like a normal DLL:
One way to grab a copy of a GAC DLL is to cd to C:\Windows\assembly\GAC_MSIL from a command prompt, and list the contents with dir. This is a hidden GAC directory. If you find the assembly you need, cd into that, and you will find folders for different .NET versions (e.g. 3.5.0.0). cd into the right one and you should find the DLL itself which you can copy out. On my computer I found it at:
C:\Windows\assembly\GAC_MSIL\System.ComponentModel.DataAnnotations\3.5.0.0__31bf3856ad364e35
I think if you use MSBuild instead of csc you don’t need hard references to GACed DLLs, it will find them for you.