Showing posts with label NAnt. Show all posts
Showing posts with label NAnt. Show all posts

Tuesday, September 21, 2010

NAnt and the .Net 4 error

NAnt threw this odd error today.

The reason for it being odd was the version of the .Net framework being used in the call: .Net 4.0, instead of 3.5.  While I have 4.0 installed, I was trying to build a 3.5 project.

A little searching and I soon had a good guide of how to build 4.0 projects using NAnt, but this wasn't the solution to my problem.

Why 4.0?

Now it is possible to tell NAnt which framework to use, the -t: switch from the command line or in the main NAnt.exe.config file. I tried, and failed. NAnt threw the same error.

I wanted to stop NAnt using .Net 4.0, but how? Well, near the bottom of the config file is a list of supported Frameworks, of which 4.0 is one.

Removing the entry for 4.0 fixed the problem. Certainly this is a quick fix as NAnt has a problem with .Net 4.0 on my PC, but not a problem to be fixed today.

Update

Thanks to Rawdon for mentioning the path to the configuration file. You can find this in %InstallLocation%\NAnt\bin\NAnt.exe.config

Also from the comments. Paul Stewart has found the cause of the problem and written it up in this post.