简体   繁体   English

如何将SQLite3.dll添加到我的项目中?

[英]How can I add SQLite3.dll to my Project?

I'm building an WPF C# Application with an embedded SQLite Database. 我正在使用嵌入式SQLite数据库构建WPF C#应用程序。

But when I debug it I always get an exception of type 'SQLite.SQLiteException'. 但是,当我调试它时,我总是会得到'SQLite.SQLiteException'类型的异常。

using System.Collections.Generic;
using System.Linq;
using SQLite;
using System.Collections;
namespace SheepMaster
    {
        class SheepDao : IEnumerable
        {

            private List<Sheep> sheeps { get; set; }

            private SQLiteConnection con = new SQLiteConnection("sheeps.db");

            public SheepDao()
            {

                con.CreateTable<Sheep>();
                sheeps = con.Table<Sheep>().ToList();
            }

            public IEnumerator GetEnumerator()
            {
                return sheeps.GetEnumerator();
            }

            public void add(Sheep value)
            {
                sheeps.Add(value);
            }
        }
    }

When I try to install sqlite from nuget I am getting the following error message: 当我尝试从nuget安装sqlite时,出现以下错误消息:

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

and when I manually install it I get this message: 当我手动安装它时,我收到此消息:

A reference to path could not be added... 无法添加对路径的引用...

System.Data.SQLite I installed it trought nuget but it didn't change anything. 我安装了System.Data.SQLite,但是它并没有改变任何东西。

可以从以下网址下载并安装sqlite3.dll: http ://sqlite.org/download.html或在nuget软件包SQLite v3.13上查找。

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

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