Reputation: 2911
I have used a 32bit OCX in my .NET 4 project built on a 32 bit platform with x86 target. When I go to run this on a 64bit windows 7 platform the DLL that has the 32 bit OCX generates the bad image exception fault. The remaining .NET libraries seem to run fine.
Does anyone have an sugguestions on what I need to do to make this work. Are there any examples on-line for this issue?
Upvotes: 0
Views: 1467
Reputation: 112259
In the project properties set the platform target to x86:
Upvotes: 1
Reputation: 43311
64-bit process can load only 64-bit libraries. There is no exception from this rule. Standard Microsoft recommendation in this case is to use some kind of interprocess communication. Specifically, COM exe server can work in such situation.
So, you need to run your application in 32 bits, or have in-process COM server in 64 bits, or use interprocess communication.
Upvotes: 0
Reputation: 6077
Try to use CorFlags.exe
to force your Assembly to run in 32 bit mode:
corflags.exe "c:\your executable.exe" /32BIT+ /Force
Upvotes: 0