Getting SQLite to work in Windows Phone 8 apps

Here’s yet another issue that took some time to figure out, so I’m writing it down!

If you create a Windows Phone 8 project in Visual Studio and want to use SQLite, it was not at all obvious what libraries, downloads, SDK’s, or nuget packages I need. In fact, you can safely conclude that the entire SQLite project is one of the most unorganized messes in the IT Industry!! Ok, maybe not that extreme – but it is a MESS!

So, I’ve been using the SQLite.NET-PCL stuff found here on Git: https://github.com/oysteinkrog/SQLite.Net-PCL (and the NuGet packages are here: http://www.nuget.org/profiles/oystein.krog)

There is a NuGet package for every Xamarin platform, AND you can have most of your code in a PCL. That’s great!

Well, Windows Store apps worked easy enough, but when I tried using this with Windows Phone, I got an error. In fact, I opened an issue on GitHub with all of the details:

WP8: The specified module could not be found
https://github.com/oysteinkrog/SQLite.Net-PCL/issues/46

What was the answer? Well, in short, you have to add the SQLite library from this screen in Add References:

image

so under the Windows Phone section, THEN Extensions. If you do that, and are using the following NuGet packages:

<packages>
  <package id="SQLite.Net.Platform.WindowsPhone8" version="2.3.0" targetFramework="wp80" />
  <package id="SQLite.Net-PCL" version="2.3.0" targetFramework="wp80" />
  <package id="sqlite-net-wp8" version="3.8.5" targetFramework="wp80" />
</packages>

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

I believe that’s all you need. This is what fixed that:

“The specified module could not be found. (Exception from HRESULT: 0x8007007E)”

Error message I was getting.

Tagged with: , ,
Posted in Mobile, Uncategorized, WindowsPhone

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Archives
Categories

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 2 other followers

%d bloggers like this: