Open jim108dev opened 2 years ago
You need to set the ResolutionPath when working with SQLite. https://fsprojects.github.io/SQLProvider/core/parameters.html#ResolutionPath
The first thing to check with SQLite is that are you running in x64 or x86 mode, and are your reference library dlls in the resolutionpath for the same x64 or x86.
@Thorium Thank you for the quick reply!
At https://fsprojects.github.io/SQLProvider/core/sqlite.html it is stated:
If System.Data.SQLite.dll is in the location where NuGet places it by default, you don't have to submit the ResolutionPath parameter at all, but you still need to copy the interop libraries as described above.
RID: ubuntu.20.04-x64
and I haven't specified the cpu in my project file, I guess its x64
then.file lib/libSQLite.Interop.so
lib/libSQLite.Interop.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=5adfce885200ee6faa387376f310e16059940c50, with debug_info, not stripped
I have tried to get it working under windows with https://github.com/fsprojects/SQLProvider/tree/master/tests/SqlProvider.Core.Tests/SQLite
I had to change the copy path to the dlls:
<Exec Command="xcopy ..\..\..\packages\tests\SQLitePCLRaw.core\lib\netstandard2.0\SQLitePCLRaw.core.dll temp\ /y" />
<Exec Command="xcopy ..\..\..\packages\tests\SQLitePCLRaw.lib.e_sqlite3\runtimes\win10-x64\nativeassets\uap10.0\e_sqlite3.dll temp\ /y" />
<Exec Command="xcopy ..\..\..\packages\tests\SQLitePCLRaw.bundle_green\lib\net461\SQLitePCLRaw.batteries_v2.dll temp\ /y" />
<Exec Command="xcopy ..\..\..\packages\tests\Microsoft.Data.Sqlite.Core\lib\netstandard2.0\Microsoft.Data.Sqlite.dll temp\ /y" />
and I get
C:\Users\User\Documents\github\SQLProvider-master\tests\SqlProvider.Core.Tests\SQLite\Program.fs(25,11): error FS3033: The type provider 'FSharp.Data.Sql.SqlTypeProvider' reported an error: Could not load file or assembly 'SQLitePCLRaw.core, Version=2.0.3.851, Culture=neutral, PublicKeyToken=1488e028ca7ab535' or one of its dependencies. The system cannot find the file specified., Path: C:\Users\User\Documents\github\SQLProvider-master\tests\SqlProvider.Core.Tests\SQLite\temp (You are NOT running on x64.) [C:\Users\User\Documents\github\SQLProvider-master\tests\SqlProvider.Core.Tests\SQLite\SqlProvider.Core.Tests.fsproj]
C:\Users\User\Documents\github\SQLProvider-master\tests\SqlProvider.Core.Tests\SQLite\Program.fs(25,11): error FS3033: The type provider 'FSharp.Data.Sql.SqlTypeProvider' reported an error: Could not load file or assembly 'SQLitePCLRaw.core, Version=2.0.3.851, Culture=neutral, PublicKeyToken=1488e028ca7ab535' or one of its dependencies. The system cannot find the file specified., Path: C:\Users\User\Documents\github\SQLProvider-master\tests\SqlProvider.Core.Tests\SQLite\temp (You are NOT running on x64.) [C:\Users\User\Documents\github\SQLProvider-master\tests\SqlProvider.Core.Tests\SQLite\SqlProvider.Core.Tests.fsproj]
C:\Users\User\Documents\github\SQLProvider-master\tests\SqlProvider.Core.Tests\SQLite\Program.fs(30,18): error FS0039: The type 'Object' does not define the field, constructor or member 'GetDataContext'. [C:\Users\User\Documents\github\SQLProvider-master\tests\SqlProvider.Core.Tests\SQLite\SqlProvider.Core.Tests.fsproj]
C:\Users\User\Documents\github\SQLProvider-master\tests\SqlProvider.Core.Tests\SQLite\Program.fs(33,24): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [C:\Users\User\Documents\github\SQLProvider-master\tests\SqlProvider.Core.Tests\SQLite\SqlProvider.Core.Tests.fsproj]
C:\Users\User\Documents\github\SQLProvider-master\tests\SqlProvider.Core.Tests\SQLite\Program.fs(34,20): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. [C:\Users\User\Documents\github\SQLProvider-master\tests\SqlProvider.Core.Tests\SQLite\SqlProvider.Core.Tests.fsproj]
The build failed. Fix the build errors and run again.
I guess Microsoft.Data.Sqlite.dll
is x86. How do I get the x64 version?
@Thorium Thank you for the quick reply!
At https://fsprojects.github.io/SQLProvider/core/sqlite.html it is stated:
If System.Data.SQLite.dll is in the location where NuGet places it by default, you don't have to submit the ResolutionPath parameter at all, but you still need to copy the interop libraries as described above.
- Every command I have used is plain vanilla like described above, thus this sentence applies, doesn't it?
- Dotnet info shows
RID: ubuntu.20.04-x64
and I haven't specified the cpu in my project file, I guess itsx64
then.file lib/libSQLite.Interop.so
lib/libSQLite.Interop.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=5adfce885200ee6faa387376f310e16059940c50, with debug_info, not stripped
I'm experiencing the same problem, I'm trying to use the provider on a Win 11 machine using Rider. And although the inerop file is located in
\SolutionName\Project\bin\Debug\net8.0\runtimes\win-x64\native
, the provider reports not being able to locate it.
I think the docs aren't clear enough about where the SQLite.Interop.dll file should be copied to.
PS. I copied the SQLite.Interop.dll
file into USERDIRECTORY\.nuget\packages\stub.system.data.sqlite.core.netstandard\1.0.118\lib\netstandard2.0
and it worked. I think the Data.SQLite team changed some parts of the NuGet package setup, so maybe docs for the provider needs to be updated.
ResolutionPath is a static parameter to SqlProvider like connectionstring is, so you pick a folder. Often easier to point a separate folder instead of Nuget path.
Even if your machine and your OS are x64, it might be that your compiler is running on x86.
Describe the bug I can't get most basic example like https://fsprojects.github.io/SQLProvider/core/sqlite.html working.
To Reproduce Steps to reproduce the behavior:
Create new console application.
Build sqlite-netFx
Add lib to SQLite.fsproj (in ItemGroup)
Copy
northwindEF.db
from SQLProvider toSQLite/db
Add to Program.fs
Run
System information
Should this work? Is the documentation up to date? Which point am I missing?
Thank you!