Search code examples
c#sqliteportable-class-library

How do I set up a SQLiteConnection on Windows?


I am using this nuget package: SQLite.Net-PCL to read data from a SQLite Database in my integration Test library.

Previously when doing this I wrote the following code to initialise a SQLiteConnection

var plat = new SQLite.Net.Platform.Win32.SQLitePlatformWin32();
return new SQLite.Net.SQLiteConnection(plat, "MyDatabasePath");

To do this I had to add another nuget package: SQLite.Net PCL - Win32 Platform but this package has now been delisted.

I would like to create another test library for a different project but as the nuget package I was using has been delisted I can no longer use this method to create a SQLiteConnection

So what is the correct way to create a SQLiteConnection on windows?


Solution

  • Turns out that this is the correct way to set up a SQLiteConnection but due to a bug in the way the nuget package was packaged. My library could not see the Win32 namespace.

    More info on the bug: https://github.com/oysteinkrog/SQLite.Net-PCL/issues/310