How to run NUnit tests using R#5 on 64 bit windows?

I have two machines, one is running 32 bit Windows XP OS and the other is running 64 bit windows server 2008 OS

I installed R#5 on both machines, and noticed that I could successfully run unit tests from within VS 2008 from the machine running XP, but I got an error trying to run the same tests on the machine runing Windows Server 2008.

The error I get is:

********.Automation.Tests.MyMethod (TestFixtureSetUp):
System.BadImageFormatException : Could not load file or assembly 'WatiN.Core, Version=2.0.10.928, Culture=neutral, PublicKeyToken=db7cfd3acb5ad44e' or one of its dependencies. An attempt was made to load a program with an incorrect format.

The key observation is that I can get this same error consistently on my Windows Server 2008 machine if I run don't run the right version of standalone nunit-gui (that is, if I run nunit-gui.exe standalone, I get this error, but not if I run nunit-x86.exe)

Is there a way to configure R#5 in 64-bit environment to use right version of NUnit?

Also, on my Windows Server 2008 machine running R#4.5, everything was fine, it is now not working with R#5

Thanks!
Dominique

5 comments
Comment actions Permalink

Hello,

It looks like your executable has some x86-only dependencies that could not
be loaded when running AnyCPU (which appears to be x64 on 64-bit systems).
Make sure your solution configuration says x86 not AnyCPU in Visual Studio,
for R# to know what environment to run your tests in.


Serge Baltic
JetBrains, Inc — http://www.jetbrains.com
“Develop with pleasure!”


0
Comment actions Permalink

Hi,
I am getting this error too.

(System.BadImageFormatException : Could not load file or assembly 'RevMath, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.)

Since my project references a dll (a c++ project) that cannot be compiled with x86, i need to have the solution configuration as Any Cpu and have the c++ project compiled win32. I get the same problem in nUnit unless I run the nUnit-x86.exe.
Is there anything I can do to make this work?

Thanks,
Cem
-------------------------------------------------------------
I am running

JetBrains ReSharper 5 Full Edition Pre-Release
Build 5.0.1618.49 on 2010-02-17T17:49:36



Microsoft Visual Studio 2008
Version 9.0.30729.1 SP
Microsoft .NET Framework
Version 3.5 SP1

0
Comment actions Permalink

Hello,

I cannot quite understand the configuration. You say that you have the C++
project compiled for x86, but that it also cannot be compiled for x86. Which
is the case?


Serge Baltic
JetBrains, Inc — http://www.jetbrains.com
“Develop with pleasure!”


0
Comment actions Permalink

Thanks for the reply and sorry for creating confusion. Totally my fault. Let me try to be more clear and give a bit more info as I still haven't figured this out.

My tests (in C#) create a C# object called ProdLoc. ProdLoc has a component called Demand (in C++). Thus the C# project that ProdLoc belongs to references a C++ project (CemMath.dll) that Demand belongs to.
CemMath (which is c++) needs to be compiled in win32 configuration. All the other projects are compiled in Any CPU configuration.

When I don't use a C# class that references the C++ project R# test runner works brilliantly. But with the tests that has ProdLoc in them, R# test runner gives the System.BadImageFormatException.

Just as a clue: In nUnit (2.5.3)  when I run through the default gui app, I get the same error in the ProdLoc tests. When I run nunit-x86.exe I don't get the error and my tests runs OK.
In addition these tests were running OK in another machine same version of Visual Studio with Resharper 4.5.

Thanks again and let me know if more info is required.

Cem

-------------------------------------------------------------
I am running

Windows 7

JetBrains ReSharper 5 Full Edition Pre-Release
Build 5.0.1618.49 on 2010-02-17T17:49:36



Microsoft Visual Studio 2008
Version 9.0.30729.1 SP
Microsoft .NET Framework
Version 3.5 SP1

0
Comment actions Permalink

I got it resolved.
I changed the target platform of the test project to x86 from project properties>build and it fixed the problem.

Thanks,
Cem

0

Please sign in to leave a comment.