gpt4 book ai didi

c# - VS2012EXPRESS Ado.Net SQLite 缺少 DLL 问题

转载 作者:太空宇宙 更新时间:2023-11-03 11:10:43 24 4
gpt4 key购买 nike

我正在尝试弄清楚如何在 VS2012 Express 中使用 ADO.Net Sqlite,但不幸的是。

我从头开始做的事情:

  1. 启动新项目并通过 NuGet 安装“System.Data.SQLite (x86/x64)”以解决问题。
  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)

有什么想法可以让这项工作成功吗?我是否做错了什么/缺少任何步骤?

最佳答案

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

我通常将 Interop DLL 添加到我的项目中作为引用,并将它们标记为复制到输出目录,以确保使用这些项目的其他人不会忘记手动步骤。

关于c# - VS2012EXPRESS Ado.Net SQLite 缺少 DLL 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14149771/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com