Use the C# 3.5 compiler to target .NET 2.0 runtime to take advantage of the latest language features.
diff --git a/nant-common.xml b/nant-common.xml
index e4d8738..c962d83 100644
--- a/nant-common.xml
+++ b/nant-common.xml
@@ -44,6 +44,7 @@
     <property name="current.build.config"    value="${if(project.release.type == 'release', 'release', 'debug')}" overwrite="false" />

     <property name="current.build.framework" value="${framework::get-target-framework()}" overwrite="false" />

     <property name="current.build.defines"   value="${build.defines}" />

+    <!-- TODO: Add net-4.0 once NAnt supports it. -->

     <property name="build.framework.strings" value="net-2.0,net-3.5,mono-2.0,netcf-2.0,netcf-3.5" unless="${property::exists('build.framework.strings')}"/>

     <property name="current.build.framework.assembly.dir" value="${framework::get-assembly-directory(framework::get-target-framework())}" dynamic="true" />

 

@@ -115,7 +116,7 @@
         </if>

 

         <property name="current.build.keysign" value="${current.build.framework.sign}" />

-        <property name="build.bin.dir" value="${build.dir}/${nant.settings.currentframework}/${current.build.config}" />

+        <property name="build.bin.dir" value="${build.dir}/${current.build.framework}/${current.build.config}" />

         <if test="${not(build.skip)}">

             <echo message="Doing ${if(current.build.keysign,'a signed','an unsigned')} ${current.build.config} build for the ${current.build.framework.name} framework" />

             <mkdir dir="${build.bin.dir}" />

@@ -204,8 +205,9 @@
         <property name="current.build.framework.sign" value="true" />

         <property name="link.sdkdoc.version" value="SDK_v2_0" />

         <property name="link.sdkdoc.web" value="true" />

-        <if test="${framework::exists(current.build.framework)}">

-            <property name="nant.settings.currentframework" value="${current.build.framework}" />

+        <!-- Use the .NET 3.5 compiler for improved language features.  Still targets same runtime. -->

+        <if test="${framework::exists('net-3.5')}">

+            <property name="nant.settings.currentframework" value="net-3.5" />

         </if>

     </target>

 

@@ -221,6 +223,16 @@
         </if>

     </target>

 

+    <target name="set-net-4.0-framework-configuration">

+        <property name="current.build.framework" value="net-4.0" />

+        <property name="current.build.framework.name" value=".NET 4.0" />

+        <property name="current.build.defines" value="${build.defines}NET,NET_2_0,NET_3_5,NET_4_0" dynamic="true" />

+        <property name="current.build.framework.sign" value="true" />

+        <property name="link.sdkdoc.version" value="SDK_v6_1" />

+        <property name="link.sdkdoc.web" value="true" />

+        <property name="nant.settings.currentframework" value="${current.build.framework}" />

+    </target>

+

     <target name="set-netcf-2.0-framework-configuration">

         <property name="current.build.framework" value="netcf-2.0" />

         <property name="current.build.framework.name" value=".NET Compact Framework 2.0" />