NBehave and .NET 4.0 - binding

May 18, 2010 at 8:49 AM

I have a test dll that is made with VS2010 . The test in with .NEt 4.0 . In NUnit Gui the test works - and NUnit GUI recognize the .NET 4.0 version

For NunitCOnsole I specify in the command line the .NET 4 version

nunit-console.exe /framework=v4.0.30319

When I try to load with nbehave console the test, the following error message occurs:

"Unhandled Exception: System.BadImageFormatException: Could not load file or assembly 'file:///[....]Test.dll' or one of its  dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded."

Please help !

May 21, 2010 at 9:12 AM

This seems like an NUnit issue.  Is there anything which makes you think that NBehave is contributing to this?  If not, then please get in contact with the NUnit community.

May 21, 2010 at 10:22 AM
I interpreted your post as: your code is compiled with .NET 4.0 You run "nbehave-console.exe <.net 4.0 compiled dll> ..." If this is what you are trying to do then you have to compile nbehave for .net 4.0
May 22, 2010 at 6:38 AM
Edited May 22, 2010 at 6:38 AM

@john rayner

NUnit runs succesfully on the dll test , Nbehave not


Yes, the test dll ( and the dll that is testing) are made with .NET 4.0

Yes, I could compile nbehave with .NET 4.0 ( there must be an option in VS )

However, I know that NUnit console is compiled with .NET 2.0 and has an command line option to load .NET 4.0 dll. I have tested and it works with my .NET 4.0 dll

Please,could you make this option available in Nbehave and pass as a argument to NUnit ? ( I am a lazy developer too )

Oct 10, 2010 at 7:36 PM

It's been a while, but you might be interested to know that we now have .Net 4.0 support on the NBehave trunk (http://teamcity.codebetter.com/viewType.html?buildTypeId=bt50).  It will be released in the next version.

Oct 10, 2010 at 7:52 PM

Nice news!Waiting ...!

Oct 10, 2010 at 8:10 PM

why wait? Grab the latest build from the build server ;)