Unhandled Exception: System.BadImageFormatException: Could not load file or assembly

.NET Error Message: Unhandled Exception: System.BadImageFormatException: Could not load file or assembly 'ChilkatDotNet2, Version=7.7.5.0, Culture=neutral, PublicKeyToken=eb5fc1fc52ef09bd' or one of its dependencies. An attempt was made to load a program with an incorrect format. File name: 'ChilkatDotNet2, Version=7.7.5.0, Culture=neutral, PublicKeyToken=eb5fc1fc52ef09bd' at MailBounce.Program.Main(String[] args)

Solution:Your program is trying to use a DLL targeted for win32 on an x64 platform, or the reverse: you have an x64 DLL and are trying to run it on a win32 computer.

C# dll is built for 'Any CPU' platform by default. On 64 bit machine 'Any CPU' maps to 64 bit platform. Now when I run such a C# project which has been built for 'Any CPU' platform and refers a 32bit dll, BadImageFormatException is thrown because loader tries to load a 32 bit dll in 64 bit process address apace which is obviously going to fail.

so you either need to run it in a 32-bit OS or you have to make your application run inside WoW64. To force the app to run in WoW64 you can go to the project properties in VS, select the "build" tab, and set the "platform target" to x86.

需要翻译吗?简单来说,就是属性设置里应用平台不要选any cpu,改成x86,重新编译,OK。

转载自:点击打开链接

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值