tags:

views:

15

answers:

1

hi,

following situation:

  • tests.dll contains a bunch of unit tests

  • program.exe contains some to be tested classes

  • tests.dll contains tests using the classes in program.exe

  • therefore tests.dll has a reference on program.exe

  • nunit-agent.exe loads tests.dll and this then loads program.exe

--> basically in the nunit environment program.exe is used like a dll. 'misusing' an exe as dll is possible as i just wrote a little test application that also references program.exe and uses some classes defined in there and this runs fine ...

BUT in nunit i get a BadImageFormatException as soon as tests are loaded that use code defined in program.exe

is this a bug in nunit's reflection mechanism or is there a reason for that?

thx tobi

A: 

This can happen if the .exe is compiled for x86 and you are running the tests on a 64 bit OS. If this is the case you may choose to use nunit-x86.exe for running the tests.

Jakob Christensen
in my situation everything is done on the same 64 bit windows 7 machine ... so this does not seem to be the problem here
Tobias
By default Visual Studio 2010 targets the x86 platform when you create a new .exe project. Your .exe may be compiled for x86 which may cause your problems. Check the project settings in VS for the .exe.
Jakob Christensen