BadImageFormatException when trying to run unit tests

We have a solution that has both x86 and x64 builds. When we build the x64 version and try to run unit tests (NUnit) via ReSharper within Studio, we get:

System.BadImageFormatException: Attempted to load a 64-bit assembly on a 32-bit platform. Use ReflectionOnlyLoad() instead if trying to load for reflection purposes.

This is using ReSharper 4.0.799.16 with a build date of 5/13/08. Another computer, running same Studio, same source code, but with ReSharper 3.1.584.3, build date of 2007-12-20 does not have this problem. It runs the unit tests without a problem. We are using the same version of NUnit on both systems. The systems are both 64-bit computers running Windows Vista 64.

I saw a post about using coreflags.exe to force builds for a specific platform, which may work for a stopgap solution (although we haven't tried it yet). But is this a known issue/will it get fixed for the release?


Comment actions Permalink

Forgot to mention:

Microsoft Visual Studio 2008
Version 9.0.21022.8 RTM
Microsoft .NET Framework
Version 3.5

Installed Edition: Professional

Microsoft Visual C# 2008 91605-270-1501536-60335
Microsoft Visual C# 2008

Comment actions Permalink

I added a report of this to the issue database, RSRP-71135. Searching some more a few days later, I noticed RSRP-52993. This looks like it might be a related problem, with the 64/32 circumstances reversed.

One more bit of info: the solution we are using does not have an AnyCPU configuration, just x64 and x86.



Please sign in to leave a comment.