≡ Menu

Targetting NAnt to a different framework version

I’m sure this is all over the web, but bugger if I had a hard time initially finding it. I’ve been working on some custom extensions to NUnitASP and was having trouble building the project. The NUnitASP guys provide an NAnt build script, but when I ran it I was getting the following:

BUILD FAILED

[csc] C:\Windows\Microsoft.NET\Framework\v1.0.3705\csc.exe failed to start. The system cannot find the file specified

Which, of course, was driving me crazy because I was specifying in my path to use v1.1. But it was ignoring that, and I couldn’t figure out why.

Turns out, I just need to learn the tools I’m using. Once I spoke with the NUnitASP guys and found out it wasn’t an issue with them, but something with NAnt, I found the following article:

One note: NAnt may be configured out of the box to use a different .NET Framework version than you would like. For example, NAnt 0.84 is configured to use .NET Framework version 1.0 by default. If you only have version 1.1 of the .NET Framework installed on your machine and you try running NANT 0.84 on a task that requires the framework, you will get an error similar to this one:

[csc] C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\csc.exe failed to start.
The system cannot find the file specified

To change the default framework version, you need to edit NAnt.exe.config in the \bin directory. Change the default argument in the platform tag to the .NET Framework version you would like to use as the default. The following example sets the default Framework to use to 1.1:




...


4 Guys From Rolla

Comments on this entry are closed.

  • Anonymous June 7, 2005, 2:19 am

    Thanks for putting that up Cory, you just saved me half a day searching for it! :)

  • Vishal April 23, 2007, 4:40 am

    thanks..i am looking for it.

Next post:

Previous post: