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

2

7

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.

Amery answered 13/4, 2010 at 8:54 Comment(0)
W
4

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.

Woodsy answered 24/4, 2010 at 20:12 Comment(0)
J
1

The NAnt team has just release NAnt 0.91 Alpha 1, with .NET 4.0 support (experimental). Please download to test and provide your valuable feedback to the team.

Thanks.

Josey answered 30/5, 2010 at 14:47 Comment(3)
I am now using nant 0.92. To Restate my objective, I want to use the 4.0 compiler to target 3.5 (ie the 2.0 CLR instead of the 4.0 CLR). I have tried using <property name="nant.settings.currentframework" value="net-3.5" /> but this suggests some of my 4.0 syntax is invalid. I have also tried using <property name="nant.settings.currentframework" value="net-4.0" /> which does compile, but I worry about whether this will fail in production, which will only have .Net 3.5 present. How do I get the best of both worlds as supplied by the IDE?Amery
Sorry I meant 0.91 alpha 2 :)Amery
Best thing to do is to post your question to the NAnt users lists directly. nant.sourceforge.net/mailinglists.htmlJosey

© 2022 - 2024 — McMap. All rights reserved.