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

前端 未结 20 2717
悲&欢浪女
悲&欢浪女 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:30

    I was able to fix this issue by matching my build version to the .NET version on the server.

    I double clicked the .exe just to see what would happen and it told me to install 4.5....

    So I downgraded to 4.0 and it worked!

    So make sure your versions match. It ran on my dev box fine, but server had older .NET version.

提交回复
热议问题