VS2012EXPRESS Ado.Net SQLite缺少DLL问题

本文关键字:DLL 问题 缺少 SQLite Ado Net VS2012EXPRESS | 更新日期: 2023-09-27 17:50:41

我想弄清楚如何使用ADO。. Net Sqlite在VS2012 Express中没有运气。

我从头开始做的事情:

  1. 启动新项目并安装"System.Data"。SQLite (x86/x64)"通过NuGet解决方案。
  2. 添加using System.Data.SQLite;到指令。
  3. 编写简单的代码,如:

    SQLiteConnection sql_sck = new SQLiteConnection("Data Source=test.sqlite;Version=3; new =False;Compress=True;");

一切看起来都很好,VS识别类名并改变它们的颜色。然而,在运行程序后,在sql_sck…行,抛出异常-关于丢失DLL ?

An unhandled exception of type 'System.DllNotFoundException' occurred in System.Data.SQLite.dll
Additional information: Could not load DLL 'SQLite.Interop.dll': Could not find specified module. (Exception HRESULT: 0x8007007E)

有什么好主意吗?我做错什么了吗?

VS2012EXPRESS Ado.Net SQLite缺少DLL问题

Visual Studio可能已经创建了SQLite.Interop.DLL。您需要找到该DLL并将其复制到与应用程序可执行文件相同的目录中。

我通常将互操作dll添加到我的项目中作为参考,并标记它们以便复制到输出目录,以确保使用项目的其他人不会忘记手动步骤。