Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get Nant to use the 4.0 compiler to target .Net 3.5

Yes I know that sounds a little bit crazy, but I've got .Net 3.5 deployed in the field and I'd like to use the new 4.0 compiler to target it.

There are several new syntactic sugar features in the latest versions of Vb.Net and C# which I would like to use, but I am unable (just yet) to force a new version of the .Net framework and CLR on my client base.

Before the naysayers jump in with both feet... I have just successfully used Studio 2010 to compile a 3.5 targeted app which used VB.Net auto properties (A new feature in VB.Net 10) so I know the compilers are capable somehow.

So back to my question.... How do I convince Nant to use the 4.0 compiler, but to target .Net 3.5 (CLR 2.0)

Update: I am using the csc and vbc tasks and not the Solution task. although I'd settle for an answer on how to do this direct with the compilers at this point.

like image 853
Rory Becker Avatar asked Apr 13 '10 08:04

Rory Becker


1 Answers

Which version of NAnt are you using?

I recall that NAnt 0.85 didn't ship with .NET 3.5 support, you had to add that support by editing a NAnt config file. The same has to be done for .NET 4 support, even in the current NAnt.

There's some discussion on the matter, the link points to the solution.

Incidentally, the NAnt team are working on a .90 update release, and are looking to have .NET 4 support in 0.91.

like image 61
Grant Palin Avatar answered Sep 29 '22 10:09

Grant Palin