Q:

WCF service library : BadImageFormatException with 32 bit dll

My project Structure looks like this:
 myApp 
 -->WCFSerLib (Any CPU Deafult application) 
 -->ClassLib1 (Any CPU)
 -->ClassLib2 (x86)

When I try to execute my application Unfortuantely am getting this below error.
 System.BadImageFormatException was unhandled by user code

Is there anyway such that I can achieve the above?
Thanks

A:

If I guess right than you are trying to use an x86 dll on a x64 mashine. With AnyCPU the .net framework will use the currient architecture automatically.
So your application runs as a x64 Application which tries to load a x86 libary which failes. So you have two options:

Set the target architeture to x86
Add/create a x64 libary

If you have both verions (x86/x64) somewhere in you envireonment variable the operation system will choos the correct one automatically.

A:

Thank you guys,
problem was with winscard.dll it uses Handles which are Int32
.all I changed is replacing the Int32 with Int64.

