sqlite-net: Unable to load e_sqlite3 in Windows 8.1 project

I’m getting an error trying to create an SQLiteConnection in a Windows 8.1 project, it’s code that works fine on Android and iOS builds. The steps to reproduce it are as follows:

  1. Create a Blank Xaml App (Xamarin.Forms.Portable) in Visual Studio Community
  2. Use NuGet manager to add sqlite-net-pcl v1.3.1 to the Windows 8.1 project
  3. Add the following function to the Windows 8.1 App class:
protected override void OnWindowCreated(WindowCreatedEventArgs args)
{
	base.OnWindowCreated(args);

	try
	{
		var path = ApplicationData.Current.LocalFolder.Path + @"\mydb.db3";
		var connection = new SQLiteConnection(path, SQLiteOpenFlags.Create);
		connection.Close();
	}
	catch (Exception e)
	{
		Debug.WriteLine(e.Message);
		if (e.InnerException != null)
			Debug.WriteLine(e.InnerException.Message);
	}
}
  1. Build and run the Windows 8.1 application. The exception is thrown and the following output generated:
The type initializer for 'SQLite.SQLiteConnection' threw an exception.
Unable to load DLL 'e_sqlite3': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

Is this a bug, or do I need to do something different on Windows builds?

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 16 (8 by maintainers)

Most upvoted comments

You shouldn’t need “SQLite for Windows Runtime (Windows 8.1)”, but that won’t solve your problem.

Your other settings look fine, so I don’t immediately see what is wrong.

You should first check to see if the e_sqlite3.dll file is in fact appearing somewhere in your build output directory.