SQLite.Interop.dll导致ILRepack错误

时间:2014-07-21 01:46:10

标签: vb.net dll

我试图将我的VB .EXE与SQLite.Interop.dll合并。我无法在此DLL上使用ILRepack,我收到以下错误:

ERROR: Failed to load assembly D:\+ WORK\Test\ILRepack\4\x86\SQLite.Interop.dll
System.BadImageFormatException: Format of the executable (.exe) or library (.dll) is invalid.
   at Mono.Cecil.PE.ImageReader.ReadOptionalHeaders(UInt16& subsystem, UInt16& dll_characteristics)
   at Mono.Cecil.PE.ImageReader.ReadImage()
   at Mono.Cecil.PE.ImageReader.ReadImageFrom(Stream stream)
   at Mono.Cecil.ModuleDefinition.ReadModule(Stream stream, ReaderParameters parameters)
   at Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters)
   at Mono.Cecil.AssemblyDefinition.ReadAssembly(String fileName, ReaderParameters parameters)
   at ILRepacking.ILRepack.ReadInputAssemblies()
   at ILRepacking.ILRepack.Repack()
   at ILRepacking.ILRepack.Main(String[] args)

我认为它与托管程序集有关。我知道应该包括哪个包?

1 个答案:

答案 0 :(得分:0)

ILRepack和ILMerge都不能处理本机程序集(SQLite.Interop.dll,即非托管代码),因为它们都在字节码(IL)级别上运行。

您可以将此库从合并中移除,或者(我假设您想要包含它)转而使用Costura方式,这适用于本机程序集。