x64 で MSTest を使用すると問題が発生しました。テスト プロジェクトはいくつかの C++/CLI アセンブリに依存しており、何らかの理由でロードに失敗します。Visual Studio では、次のようになります (簡略化):
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.
コマンド プロンプトで MSTest を手動で実行すると、次のようになります。
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.
言及する価値のある詳細:
- テスト プロジェクト自体は、「Any Cpu」を使用してコンパイルされます。
- x64 固有の testrunconfig を使用します
- Dependency Walker は、C++/CLI アセンブリ (Common.Geometry.Native) で欠落しているネイティブ依存関係を示しません
- さらに興味深いことに、同じ C++/CLI アセンブリ (Common.Geometry.Native) を使用する同じソリューションに別のテスト プロジェクトがあり、問題なく実行されます。
また、干渉する 32 ビット アセンブリ/DLL がないことも確認しました。
どんな提案も大歓迎です!