“An attempt was made to load a program with an incorrect format” even when the platforms are the same

前端 未结 20 2611
悲&欢浪女
悲&欢浪女 2020-11-22 13:57

I\'m calling functions from a 32-bit unmanaged DLL on a 64-bit system. What I get is:

BadImageFormatException: An attempt was made to load a program w

相关标签:
20条回答
  • 2020-11-22 14:38

    I got this issue solved in the 'Windows' way. After checking all my settings, cleaning the solution and rebuilding it, I simply close the solution and reopened it. Then it worked, so VS probably didn't get rid of some stuff during cleaning. When logical solutions don't work, I usually turn to illogical (or seemingly illogical) ones. Windows doesn't let me down. :)

    0 讨论(0)
  • 2020-11-22 14:39

    A bit off topic for this post, but searching for this error message brought me here.

    If you are building through team system and getting this error, the build definition process tab has a "MSBuild Platform" setting. If this is set to "Auto", you may experience this problem. Changing it to "X86" can also resolve the error.

    0 讨论(0)
提交回复
热议问题