Reputation: 14148
I wrote a wrapper class for log4net. This wrapper class works correctly with asp.net web application. And now I am trying to test my wrapper class methods using NUNIT. In wrapper class project, I set "Copy Local" to True for log4net DLL. Both NUNIT project and wrapper class are using log4net 1.2.10.0.
This wrapper class works correctly with my separate asp.net web project but some how does not work with my nunit test project.
When I try to run a basic test, I get the following exception
System.BadImageFormatException : Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. An attempt was made to load a program with an incorrect format.
I am running these test within Resharper for VS2010
UPDATE
Just updated my wrapper and test projects with log4net.dll version 1.2.11.0 and every thing starts to work magically!!! I don't know how this latest version fix this problem where 1.2.10.0 kept failing
Upvotes: 2
Views: 791
Reputation: 11158
It seems that you are loading a 32-bit DLL on a 64-bit system. You shall build your tests DLL targetting a 32-bit architecture.
Process is described in existing question: Using a 32 bit dll on a 64 bit machine
Upvotes: 3