This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Unhandled Exception: System.TypeInitializationException: | |
The type initializer for 'NAnt.Console.ConsoleStub' threw an exception. | |
System.Security.SecurityException: Request for the permission of type | |
'System.Security.Permissions.FileIOPermission, mscorlib, Version=4.0.0.0' |
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<startup> | |
<!-- .NET Framework 4.0 --> | |
<supportedRuntime version="v4.0.30319" /> | |
<!-- .NET Framework 2.0 --> | |
<supportedRuntime version="v2.0.50727" /> | |
<!-- .NET Framework 1.1 --> | |
<supportedRuntime version="v1.1.4322" /> | |
<!-- .NET Framework 1.0 --> | |
<supportedRuntime version="v1.0.3705" /> | |
</startup> |
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.