NAnt: Start Using the C# 3.0 Compiler Without Visual Studio 2008
Posted on December 06, 2007 @ 04:25
One of the benefits about building with NAnt is being able to flip the switch and start targeting a different compiler, without having to switch to the latest version of Visual Studio. Although, you wont get the intellisense provided by studio for new features.
So today we flipped the switch on a project at work, from targeting the C# 2.0 compiler to the C# 3.0 compiler. We haven’t started leveraging any of the new functionality available in the new compiler but at least we know we can start.
So to flip the switch you’ll need to update your “nant.exe.config” file to include the .NET Framework version 3.5. Remember with this release we got a new version of the .NET Framework assemblies, a new C# 3.0 compiler but we’re still running it all in the 2.0 version of the CLR.
The new xml element to add to your “Nant.exe.config” file looks something like this:
To flip the switch you can either override the nant setting in your build file …
or you can change the default target framework in the “nant.exe.config” file.