MSTest on x64 C++/CLI

Posted by Oyvind on Stack Overflow See other posts from Stack Overflow or by Oyvind
Published on 2012-07-10T12:27:31Z Indexed on 2012/09/11 3:38 UTC
Read the original article Hit count: 338

Filed under:
|
|
|

I got a problem using MSTest on x64: The test project depends on a couple of C++/CLI assemblies, and fails to load for some reason. In Visual Studio, I get (stripped down):

Error loading D:\xxx\Xxx.Test.dll: Unable to load the test container 'D:\xxx\Xxx.Test.dll' or one of its dependencies. Error details: System.BadImageFormatException: Could not load file or assembly 'Common.Geometry.Native, Version=1.1.4574.22395, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.

Running MSTest manually in a command prompt, I get:

Unable to load the test container 'D:\xxx\Xxx.Test.dll' or one of its dependencies. Error details: System.IO.FileNotFoundException: Could not load file or assembly 'Common.Geometry.Native, Version=1.1.4574.22395, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

Details worth mentioning:

  • The test project itself is compiled using 'Any Cpu'.
  • I use a x64 specific testrunconfig
  • Dependency walker shows no missing native dependencies in the C++/CLI assembly (Common.Geometry.Native)
  • Even more interesting, there is another test project in the same solution using the same C++/CLI assembly (Common.Geometry.Native), and it runs without any problems.

I have also verified that there are no 32bit assemblies/dlls interfering.

Any suggestions is welcome !

© Stack Overflow or respective owner

Related posts about visual-studio-2010

Related posts about c++-cli