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.
9 comments:
Thank you! This one had me totally stumped as we were migrating all of our dev boxes to brand new images of Windows Server 2008 and Visual Studio 2010
@Seth. Glad it was of help.
Sweet ! Spent ages typing to work this out, for anyone unsure the config file you want to change is in your nant bin foler e.g. C:\ProgramFiles\NAnt\bin\NAnt.exe.config
Yep, a niggly bug. Thanks for the adding the path to the config file.
Pretty nice fix. Thanks for the help. Pretty nice finding.
I don't know if you ever got to the bottom of this problem, but this blog post held the answer for me: http://www.byteblocks.com/post/2011/01/19/Nant-Build-Error-SystemSecurityPermissionsFileIOPermission.aspx
Thanks a bunch!
nice work.Thanks saved me lot of time
Awesome. I'm looking to use Nant to help with deployments and this issue was the only thing standing in my way.
Post a Comment