Reputation:
i have created a simple "public ref class" in the vc++ project, which is configured to generate a dynamik library. In the c# Project (simple console application) i added the vc++ project as to the References and doing a "using myVC++library". But when i try to create an object from the vc++ dll i always get: System.BadImageFormatException was unhandled
any clues or helpfull tutorials on this?
TIA
Upvotes: 0
Views: 394
Reputation: 5358
Is your c# project set to build for "Any CPU" - if it is, and you're on a 64-bit OS, then the load will fail.
The VC++ dll will be 32-bit only, and 64-bit app can't run it.
You could change your c# build to target x86 instead.
Upvotes: 1