构建System.Data.SQLite.SQLiteConnection时,是什么原因导致System.BadImageFormatException

编程入门 行业动态 更新时间:2024-10-27 08:39:21
本文介绍了构建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

System.BadImageFormatException: Could not load file or assembly 'System.Data.SQLite, Version=1.0.65.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139' or one of its dependencies. An attempt was made to load a program with an incorrect format. File name: 'System.Data.SQLite, Version=1.0.65.0, Culture=neutral, PublicKeyToken=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

本文发布于:2023-11-08 22:14:54,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1570595.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Data   System   SQLite   BadImageFormatException   SQLiteConnection

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!