Despite the unhelpful name, the BadImageFormatException error almost always results from confusion with 32-bit/64-bit DLLs and project settings. For example, you’ve tried to load a 32-bit DLL into a 64-bit application or you’ve tried to load a 64-bit DLL into a 32-bit application.

This error message can be easily replicated in a 32-bit C# application project where you use 32-bit DLLs in the code and then change the “Platform target” in “Project > Properties > Build” to x64. The BadImageFormatException error message will pop up when you next build/compile. If you specify AnyCPU or x86 for “Platform target” then this error message will not display and it should compile correctly. Generally speaking, you should use AnyCPU all the time unless you have a reason not to.

There are 32-bit and 64-bit versions of Debenu Quick PDF Library and Debenu PDF Viewer SDK so you can use our products in both 32-bit and 64-bit applications. We even have a few knowledge base articles which demonstrate how you can switch between 32-bit and 64-bit versions of our SDK’s automatically, so you don’t have to worry about 32-bit or 64-bit when it comes to our products.