使用SQLProvider和SQLite的ResolutionPath问题

时间:2016-08-04 19:58:58

标签: sqlite f# type-providers

尝试将F#SQLProvider与SQLite一起使用,我不断收到错误消息The type provider 'FSharp.Data.Sql.SqlTypeProvider' reported an error: Unable to load DLL 'SQLite.Interop.dll': The specified module could not be found.

代码:

open FSharp.Data.Sql

let [<Literal>] resolutionPath1 = 
    __SOURCE_DIRECTORY__ + @"..\..\packages\System.Data.SQLite.Core.1.0.102.0\build\net46\x86\" 
let [<Literal>] resolutionPath2 =
    @"f:\proj\WanLog\packages\System.Data.SQLite.Core.1.0.102.0\build\net46\x86"

let [<Literal>] connectionString = 
    "Data Source=" + @"F:\proj\WanLog\WanLog\bin\Debug\WanIPLog.s3db"

type sql = SqlDataProvider< 
              ConnectionString = connectionString,
              DatabaseVendor = Common.DatabaseProviderTypes.SQLITE,
              ResolutionPath = resolutionPath2,
              IndividualsAmount = 1000,
              UseOptionTypes = true >

我已经尝试了相对路径和绝对路径(resolutionPath1和resolutionPath2)并验证了SQLite.Interop.dll实际上存在于resolutionPath2中引用的目录中。

目标框架和CPU,.NET 4.6和x86,是与指定目录同步的AFAIK(以\ net46 \ x86结尾)。我错过了什么?

更新

我已根据此问题的答案更新了SQLProvider SQLite documentation

更新2:

System.Data.SQLite在1.0.104.0版中解决了这个问题。请参阅this discussion

1 个答案:

答案 0 :(得分:1)

将您的解决方案路径更改为以下内容,这应该包含SQLiteInterop.dllSystem.Data.SQLite.dll,如果文件不存在,请复制该文件:

  

包\ System.Data.SQLite.Core.1.0.102.0 \ lib中\ net46

如有必要,请与File.Exists核对。顺便提一下,您确定x86版本是否正确。我会为x64构建并在那里复制x64 dll。顺便说一句,我也会参考open System.Data.SQLite

相关问题