System.Data.SQLite安装的相关问题

在使用System.Data.SQLite的过程中,遇到各种问题,特此记录下。(都被搞的折寿了,不仔细看文档的下场!)

1.选对.net Framework的版本。
2.X64和X86的问题,如果项目指定了X64或者X86,则下载对应的SQLite。如果选择AnyCpu,最简单的办法是在程序运行目录下创建X64和X86目录,里面放对应的SQLite.Interop.dll。System.Data.SQLite.Dll会根据程序平台自动选择。
3.关于Visual C++ XXXX runtime的问题,因为SQLite是VC++开发,所以必须安装对应的Visual C++ XXXX runtime。如果电脑没有这个东西,则会出错。
4.还是Visual C++ XXXX runtime的问题(被恶心到了)。但是有的用户电脑已经安装了这玩意,还是会提示“Unable to load DLL 'SQLite.Interop.dll': 找不到指定的模块”的异常。怎么回事呢,我也不懂C++,貌似是什么静态连接的问题。

static 静态链接 版本已经包含了vc++ runtime,不需要在安装。下载“Precompiled Statically-Linked Binaries ”这种版本就可以了。 通过下载发现static版本的DLL都要大一些。

下面是官方对static的解释:
All the "static" packages contain either native or mixed-mode assembly binaries linked statically to the appropriate version of the Visual C++ runtime. Typically, these packages are used in cases where customer machines may not have the necessary version of the Visual C++ runtime installed and it cannot be installed due to limited privileges.

翻译:所有“静态”包都包含静态链接到适当版本的Visual C++ 的本机或混合模式程序集二进制文件 运行。通常,这些包用于客户机器可能没有安装必要版本的 Visual C++ 运行时并且由于权限有限而无法安装的情况

bundle 版本是把System.Data.SQLite.dll和SQLite.Interop.dll打包一起的版本。不适合AnyCpu形式编译的项目

相关链接:
http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki
http://www.cnblogs.com/zhuweisky/p/3844089.html

2018/11/7 补充 (弃,直接下载静态链接版本)

升级版本后,发现本地运行没有问题,在服务器上会报“ 未能加载文件或程序集“System.Data.SQLite.dll”或它的某一个依赖项。找不到指定的模块
文件名:“System.Data.SQLite.dll”。找不到指定的模块”。 原因如上面第四点所说,没有装vc++runtime,下载链接(Microsoft Visual C++ 2010 SP1 Redistributable Package (x86))[https://www.microsoft.com/en-us/download/details.aspx?id=8328]

另外一个不需要安装的方式,就是把“msvcr100.dll”这个dll放到程序目录下,之前程序版本为啥不用呢? 因为在xulrunner目录下已经存在这个文件了。- -!!

posted @ 2015-09-12 15:53  花生!~~  阅读(980)  评论(0编辑  收藏  举报