Take the 2-minute tour ×

I am trying to create a worker role to download data from RETS server using librets.net. librets.net is a wrapper on a c++ library librets. I tried both 32 bit and 64 bit version and followed this articlebut no success. I am still receiving BadImageFormatException

How can i solve this issue?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

BadImageFormatExceptions are almost always a 32 bit/64 bit incompatibility; If I were a betting man, I'd say you are binding the wrong version based on your Platform configuration in Visual Studio.

  • Choosing "Any CPU" will result in an assembly that will be JITted into a 64 bit version when loaded into a 64 bit process and a 32 bit version when loaded into a 32 bit process

  • Choosing "x86" will always result in a 32 bit assembly

I'd be willing to bet you've got:

  • "Any CPU" selected
  • A 64 bit computer
  • A 32-bit only version of the C++ library

Try switching everything over to 32 bit first; x86 for Platform, use the 32 bit version of the library, etc.

share|improve this answer
won the bet :) so mark as answered –  ZafarYousafi Feb 21 '13 at 16:37
Another thing is crt.realtors.org/projects/rets/librets/downloads provide to type.This time i tried with Mingw64 and it works. other 64bit was showing the same error. whats the difference between these two types of build? –  ZafarYousafi Feb 21 '13 at 16:39
Without digging into the particulars (not familiar with the library myself), I'd be outright guessing...possibly due to how Mingw64 structures the output binaries? –  JerKimball Feb 21 '13 at 16:44

Your Answer


