views:

64

answers:

2

I have an x64 managed C++ class that needs to be tested using Visual Studio 2008. This class links to a x64 unmanaged lib

I'm not able to run my my tests because vstesthost.exe (the exe Visual Studio hosts my test) is x86 and not x64.

Ideas? the error generated is

rror: System.BadImageFormatException: Could not load file or assembly ... or one of its dependencies. An attempt was made to load

+2  A: 

The testing tools in VS2008 do not support 64-bit binaries. This support has been added in VS2010, however. I don't know of any good workarounds besides the obvious of building your binary for x86.

Chris Schmich
We can test out x86 and say well it automatically works for x64. So I don't think "building your binary for x86" is a good workaround.
Lex Li
Hey Chris, I got the VS2010 trial - I'm having the same problem but suspect I'm missing an option somewhere. How do I configure the test harness to run x64?
stuck
@Chris: in the .testsettings, you need to explicitly state that you want to run tests in a 64-bit process, see http://msdn.microsoft.com/en-us/library/ee782531.aspx
Chris Schmich
A: 

Add some break (such as MessageBox) in your initialization part, so the application stops at start up. Then you can use Visual Studio to attach to its process. Then you can continue debugging in x64 mode.

Lex Li