SQLite on WP–FileNotFoundException and how to deal with it

While I was reinstalling my laptop this week, I ran into some friction getting my Brick Manager development environment going again. My issue turned out to be pretty simple, and I thought I would share out how to solve the issue to help out others that follow on behind me(because I couldn’t find anything on the interwebz).

After syncing my solution down to my newly configured dev machine, there was a System.IO.FileNotFoundException thrown by the  public static Result Open(string, out Sqlite3DatabaseHandle, int, IntPtr) method within the SQLite.cs; in particular, the exception was thrown by the Sqlite3.sqlite3_open_v2() call.

SQLite exc blog post - 01

Exception details:

  • Type: System.IO.FileNotFoundException
  • Message: The specified module could not be found.
  • HRESULT: 0x8007007E


SQLite exc blog post - 03At the root of the exception was a missing SQLite extension for Visual Studio. I had the SQLite-net and SQLite-net-wp8 NuGet packages, but Visual Studio didn’t automatically link into the SQLite for Windows Phone extension (even though it was installed).

To re-add this to your VS solution, do the following steps:

  1. Open up the project’s references by secondary-clicking on the ‘References’ node in the solution explorer and selecting ‘Add Reference…’
  2. In the Reference Manager, select ‘Windows Phone SDK 8.0’
  3. Select ‘Extensions’
  4. Check the box for ‘SQLite for Windows Phone’ if it isn’t already selected. If it isn’t in the list, then you will need to install the extension (but I will assume you already know how to do that Smile)

SQLite exc blog post - 02

Once I selected the box, everything was once again copasetic and all was good in the universe once more.

Hope this helps!