简体   繁体   English

SQLite.Interop.dll参考

[英]SQLite.Interop.dll reference

I am trying to build WinForms Application with SQLite database in Visual Studio 2017 , .NET framework 4.6 . 我正在尝试在Visual Studio 2017.NET Framework 4.6中使用SQLite数据库构建WinForms应用程序。
I installed SQLite from NuGet. 我从NuGet安装了SQLite。
I have added setup project to install all dlls from reference on user PC. 我已经添加了安装项目,以在用户PC上从参考安装所有dll。
For me, in Debug and Release mode everything work fine. 对我来说,在“调试”和“发布”模式下一切正常。 But when user installed my program he got this: 但是,当用户安装我的程序时,他得到了以下信息:

System.DllNotFoundException: Unable to load DLL 'SQLite.Interop.dll': Such module not found. System.DllNotFoundException:无法加载DLL'SQLite.Interop.dll':找不到此类模块。 (Exception from HRESULT: 0x8007007E) (来自HRESULT的异常:0x8007007E)

at System.Data.SQLite.UnsafeNativeMethods.sqlite3_config_none(SQLiteConfigOpsEnum op) at System.Data.SQLite.SQLite3.StaticIsInitialized() at System.Data.SQLite.SQLiteLog.Initialize() at System.Data.SQLite.SQLiteConnection..ctor(String connectionString, Boolean parseViaFramework) at CatFishSystem.Form1.Form1_Load(Object sender, EventArgs e) at System.Windows.Forms.Form.OnLoad(EventArgs e) at System.Windows.Forms.Form.OnCreateControl() at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible) 在System.Data.SQLite.SQLite.SQLiteLog.Initialize()在System.Data.SQLite.SQLite.SQLite3.StaticIsInitialized()在System.Data.SQLite.SQLite.SQLiteLog.Initialize()在System.Data.SQLite.SQLite.SQLiteConnection..ctor(SQLiteConfigOpsEnum op)字符串连接字符串,CatFishSystem.Form1.Form1_Load(对象发送者,EventArgs e)(System.Windows.Forms.Form.OnLoad(EventArgs e),System.Windows.Forms.Form.OnCreateControl()),CatFishSystem.Form1.Form1_Load(Object sender,EventArgs e)。 Forms.Control.CreateControl(布尔值fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl() at System.Windows.Forms.Control.WmShowWindow(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) 在System.Windows.Forms.Control.WmShowWindow(Message&m)在System.Windows.Forms.Control.WndProc(System.Windows.Forms.NativeWindow.Callback处) (IntPtr hWnd,Int32 msg,IntPtr wparam,IntPtr lparam)

When I tried to add SQLite.Interop.dll from NuGet I get this error: 当我尝试从NuGet添加SQLite.Interop.dll ,出现此错误:

Error Could not install package 'SQLite.Interop.dll 1.0.103'. 错误无法安装包'SQLite.Interop.dll 1.0.103'。 You are trying to install this package into a project that targets '.NETFramework,Version=v4.5', but the package does not contain any assembly references or content files that are compatible with that framework. 您正在尝试将此软件包安装到以'.NETFramework,Version = v4.5'为目标的项目中,但是该软件包不包含任何与该框架兼容的程序集引用或内容文件。 For more information, contact the package author. 有关更多信息,请与软件包作者联系。

I also tried to download Precompiled Binaries for 64-bit Windows .NET 4.6 from Here and add reference to SQLite.Interop.dll dirrectly. 我还尝试从此处下载适用于64位Windows .NET 4.6的预编译二进制文件,并直接添加对SQLite.Interop.dll引用。 I got this 我懂了

错误

I'm stuck and don't know what to do. 我被困住了,不知道该怎么办。 I tried different solutions but none of them helped. 我尝试了不同的解决方案,但没有一个有帮助。 Looking forward for your help. 期待您的帮助。

This issue comes with the Setup Project. 安装项目附带此问题。

You will have to add the file yourself to the Installer. 您必须将文件自己添加到安装程序。

Right-Click on your Setup Project in the Solution Exporer and add a file. 在Solution Exporer中右键单击您的安装项目,然后添加一个文件。

I allways create a x86 and a x64 folder and add the files found in the debug directory. 我总是创建一个x86和一个x64文件夹,并添加在调试目录中找到的文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM