Thursday, October 8, 2015

NUnit Test Adapter - BadImageFormatException

Yesterday I mentioned that my NUnit tests were not discovered when I set the Build Target to ‘x64’ and that I had to change it to ‘Any CPU’ to be able to run my tests.

However this only solved part of my problem as my tests started to fail with the following error message:


In theses tests I’m using Noesis.Javascript, a .NET wrapper around Google’s V8 Javascript engine, that allow you to execute scripts directly from .NET code. Noesis.Javascript.dll needs the Microsoft Visual C++ Libraries and to use them, you have to set your Compiler target to a specific platform(x86 or x64).

So back to start…

After some research, I found a solution:

  • Inside Visual Studio, click on Test –>Test Settings –>Default Processor Architecture


  • This was set to X86. Changing it to X64 solved my problem.


1 comment:

Koen said...

Had a similar problem on a build server with Oracle client (32-bit) and integration tests written with NUnit.

Solution was to use the command line options in our build script:
--x86 Run tests in a 32-bit process on 64-bit systems.