I know i am going to ask duplicate question but my scenario is totally different i think so because when i go to do unit testing with nunit tool of my program then in NUnit this error happen
"NewTest.testtest (TestFixtureSetUp): SetUp : System.BadImageFormatException : Could not load file or assembly 'AUTO_REPAIR, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format."
I wonder why this error is happening to this tool ? i am sure i dont have error in project or in any test case.
Please help me out.
here is image of this error
SOLUTION: If you are on IIS7, Right Click/ Advanced Settings on the Specific Application Pool of the website and select True on Enable 32-Bit Applications. It should work.
Solution. A System. BadImageFormatException error often occurs when a 64-bit assembly is opened by a 32-bit application. In this case, Visual Studio is a 32-bit application and the Design view is attempting to load a 64-bit assembly. Visual Studio assemblies are located in the project references tree.
There are two ways to solve this error
or
BadFormatException occurs when you attempt to load an x86 assembly in a 64bit process or vice versa. As per NUnit documentation (http://www.nunit.org/index.php?p=nunit-gui&r=2.4.2) the default runner is compiled as AnyCPU which means its a 64bit process on a 64bit machine. If one of your assemblies or any of its dependencies are directly compiled for x86 you will get this exception.
Switch to the Nunit-x86 or Nunit-console-x86.exe and everything should load correctly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With