An attempt was made to load a program with an incorrect format” even when the platforms are the same
change "Enable 32-Bit Applications" to "TRUE". Restart your website and it should work. OR In Visual Studio , Right Click your project -> On the left pane click the Build tab, under Platform Target select x86 (or more generally the architecture to match with the library you are linking to) I hope this helps someone! :)