.net – CorFlags.exe,System.Data.SQLite.dll和BadImageFormatException

前端之家收集整理的这篇文章主要介绍了.net – CorFlags.exe,System.Data.SQLite.dll和BadImageFormatException前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
http://sqlite.phxsoftware.com/对System.Data.sqlite.dll运行 CorFlags.exe会产生以下输出.

Version   : v2.0.50727
CLR Header: 2.5
PE        : PE32
CorFlags  : 24
ILONLY    : 0
32BIT     : 0
Signed    : 1

如您所见,未指定32BIT且PE等于PE32.根据Moving from 32-bit to 64-bit application development on .NET Framework,这意味着该组件是任何cpu.但是,使用64位应用程序中的程序集会导致错误

System.BadImageFormatException: Could
not load file or assembly
‘System.Data.sqlite’ or one of its
dependencies. An attempt was made to
load a program with an incorrect
format. File name:
‘System.Data.sqlite’

如果CorFlags.exe报告任何cpu,为什么会发生异常?组件是否错误标记为32BIT:0?

我知道有一个64位版本也可用,我只是想知道导致错误的原因.

解决方法

您使用的System.Data.sqlite.dll文件mixed-mode assembly,这意味着它不是纯.NET代码(另请参阅“ILONLY:0”标志),它还包含非托管机器代码,不能是“任何”中央处理器”.因此,由于DLL包含32位本机代码,因此只能将其加载到32位进程中,否则会发生BadImageFormatException.

猜你在找的Sqlite相关文章