是什么原因导致System

是什么原因导致System

本文介绍了构建System.Data.SQLite.SQLiteConnection时,是什么原因导致System.BadImageFormatException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经打破了code降低到尽可能小的语句:

I've broken the code down to the smallest possible statement:

Dim cn As System.Data.SQLite.SQLiteConnection

和我从一个WinForm应用程序了调用code当出现以下错误:

And I get the following error when calling the code from a WinForm applicaiton:

System.BadImageFormatException:可能  无法加载文件或程序集  System.Data.SQLite,版本= 1.0.65.0,  文化=中立,  公钥= db937bc2d44ff139或  它的一个依赖。尝试  是为了用一个加载程序  格式不正确。文件名:  System.Data.SQLite,版本= 1.0.65.0,  文化=中立,  公钥= db937bc2d44ff139

然而,呼吁从MS单元测试的同一块code我不明白的错误,再加上全code组按预期工作。

Yet calling the same piece of code from MS Unit Test I do not get the error, plus the full code set works as expected.

推荐答案

SqlLite包含非托管code,你不能在64位操作系统上运行它,除非你部署64位版本。快速修复:项目+属性,生成标签,平台目标= 86

SqlLite contains unmanaged code, you can't run it on a 64-bit operating system unless you deploy the 64-bit version. Quick fix: Project + Properties, Build tab, Platform Target = x86.

这篇关于构建System.Data.SQLite.SQLiteConnection时,是什么原因导致System.BadImageFormatException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 11:53