System.BadImageFormatException : Could not load file or assembly

Arathi Jinde 6 Reputation points
2021-04-14T09:47:41.567+00:00

Hi,
I am referencing X64 Clr:Core .Net Core5 C++/CLI dll in an C# Test application
when running tests there is error BadImageFileFormatException

making the C# =>X64 and C++/CLI => X64 same
making C# =>X86 and C++/CLI =>win32 same
making C# =>32 (prefer 32bit AnyCPU) , C++/CLI=>win32 same
making C# =>AnyCPU and C++/CLI =>X64 same

TestExplorer test settings to X64

in all above cases it results in same error

Microsoft.TestPlatform.TestHost generates TestHost.dll and TestHost.exe are these dlls X64 versions

87734-image.png

these are the nuget packages installed

Developer technologies | C#
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.