1

我正在尝试创建一个工作角色以使用 librets.net 从 RETS 服务器下载数据。librets.net 是 C++ 库 librets 的包装器。我尝试了 32 位和 64 位版本并按照这篇文章进行操作,但没有成功。我仍然收到 BadImageFormatException

我该如何解决这个问题?

4

1 回答 1

2

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.

于 2013-02-21T16:15:54.817 回答