Oh, I was really hoping that would do the trick but, unfortunately, it didn’t; I still get the same error:
"The type provider 'FSharp.Data.Sql.SqlTypeProvider' reported an error: Unable to load DLL 'SQLite.Interop.dll' or one of its dependencies: The specified module could not be found. (0x8007007E)”
Here’s my code as it is now (in a file called Library.fs):
namespace FSharpSQLProviderTests
module Library =
open FSharp.Data.Sql
let [<Literal>] resolutionPath = __SOURCE_DIRECTORY__ + @"/../files/sqlite"
let [<Literal>] connectionString = "Data Source=" + __SOURCE_DIRECTORY__ + @"\testDatabase.sqlite;ReadOnly=false;FailIfMissing=True;"
type sql = SqlDataProvider<
ConnectionString = connectionString,
DatabaseVendor = Common.DatabaseProviderTypes.SQLITE,
SQLiteLibrary=Common.SQLiteLibrary.SystemDataSQLite,
ResolutionPath = resolutionPath,
IndividualsAmount = 1000,
UseOptionTypes = Common.NullableColumnType.OPTION
>
Here’s my FSPROJ file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<ItemGroup>
<Compile Include="Library.fs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="dapper" Version="2.0.123" />
<PackageReference Include="SQLProvider" Version="1.3.7" />
<PackageReference Include="system.data.sqlite" Version="1.0.117" />
</ItemGroup>
</Project>
I’ve attached an image showing my Package References in VS Code (some of them are there for Dapper which I’m using to do the DB maintenance stuff).
I’ve also attached an image showing the (fully-expanded) project folder in VS Code.
The project was created using: dotnet new classlib -lang f#
I added the nuget packages using: dotnet add package <packagename>
I’ve tried closing and re-launching VS Code a few times, building and re-building the project, but that’s done nothing to help.
I found this on Stack Overflow f# - Problems with ResolutionPath using SQLProvider with SQLite - Stack Overflow but what they are saying there – and in the links given – might as well be gibberish to me. (There’s mention of copying a file but they don’t say where to copy it from, which isn’t very helpful.)
I’m assuming at the moment that either:
- I’ve done something stupid;
- I’ve missed something basic and important;
- For some reason, whatever that may be, what I’m trying to do is impossible.
(Or a mix of the above.)
I’m at a complete standstill with this now and have no idea what to do next.
I don’t even know where to turn for help because I don’t know what the root cause of the problem is so I don’t know which ‘team’ to ask about it. (Is it a problem with SQLProvider? Or with SQLite? Or with the project? Or with VS Code? Or with Ionide? Or with F#? Or with NUGET? Or with my machine? Or with me? Or something else?)
Here’s hoping that someone can help because I am totally baffled but I don’t just want to give up.
P.S. I have no problem going through the whole process again, step-by-step, with someone if that will help me to figure out what’s wrong.