Use vC ++ class library in C #

I created a simple "public ref class" in a vC ++ project that is configured to create a dynamik library. In a C # project (Simple Console Application), I added a vC ++ project in terms of references and did "using myVC ++ library". But when I try to create an object from a vC ++ dll I always get: System.BadImageFormatException was unhandled

any hints or helpful tutorials on this?

TIA

0


source to share


1 answer


Is your C # project building for "Any CPU" - if there is one and you are on a 64-bit OS then the download will fail.

The VC ++ DLL will only be 32-bit, and a 64-bit application will not be able to run it.



Instead, you can change your C # assembly to target x86.

+1


source







All Articles