zoukankan      html  css  js  c++  java
  • System.Data.SQLite.Core for .NET 5 Core manual reference

    1. SQLite官网下载原始预编译包。

    Precompiled Binaries for the .NET Standard 2.1

    1. 创建一个ASP.NET Core项目

    2. 项目添加预编译包解压缩后的引用

    System.Data.SQLite.dll

    1. 随意代码
    Con = new SQLiteConnection("data source=test.db");
    Con.Open();
    
    1. 运行代码
      你会发现以下错误:
    An unhandled exception occurred while processing the request.
    DllNotFoundException: Unable to load DLL 'SQLite.Interop.dll' or one of its dependencies: 找不到指定的模块。 (0x8007007E)
    System.Data.SQLite.UnsafeNativeMethods.sqlite3_config_none(SQLiteConfigOpsEnum op)
    
    DllNotFoundException: Unable to load DLL 'SQLite.Interop.dll' or one of its dependencies: 找不到指定的模块。 (0x8007007E)
    
    System.Data.SQLite.UnsafeNativeMethods.sqlite3_config_none(SQLiteConfigOpsEnum op)
    System.Data.SQLite.SQLite3.StaticIsInitialized() in SQLite3.cs
    System.Data.SQLite.SQLiteLog.Initialize(string className) in SQLiteLog.cs
    System.Data.SQLite.SQLiteConnection..ctor(string connectionString, bool parseViaFramework) in SQLiteConnection.cs
    System.Data.SQLite.SQLiteConnection..ctor(string connectionString) in SQLiteConnection.cs
    ...
    

    1. SQLite.Interop.dll文件
      在哪儿?官网的预编译包里没有这个文件呀。这不坑人吗?
      那就换个方式找找:
      到NuGet上找到相同版本,把System.Data.SQLite.Core 1.0.112.Nupkg文件下载下来。
      然后通过打开压缩包方式,找到它的runtimes目录。

    2. 部署
      根据你需要部署的平台,选择SQLite.Interop.dll文件,复制SQLite.Interop.dll到你编译部署的应用的根目录下,再次打开程序。

    3. OK,看起来很完美。

  • 相关阅读:
    斯特林公式
    高精度算法
    容斥原理
    贪心问题之——Dijkstra最短路
    博弈论
    JavaScript数据类型
    JavaScript变量
    认识JavaScript
    编程语言与计算机
    CSS验证工具
  • 原文地址:https://www.cnblogs.com/honk/p/14919238.html
Copyright © 2011-2022 走看看