Monthly Archives: June 2015

Using SQLite-WinRT in UWP apps

There are a number of SQLite wrapper APIs out there. In the recent MVA A Developer’s Guide to Windows 10, in module 10  I covered SQLite Local Database and walked through an example of using the SQLite-PCL wrapper from MSOpenTech. There are many other wrappers out there, the most popular of which (and which offers a very nice LINQ API) is SQLite-NET.

However, the one I support is called SQLite-WinRT which has a small but faithful band of followers, and I’ve been getting some queries about using it in Windows 10 UWP apps. For those who haven’t used it, SQLite-WinRT is a lightweight wrapper around the SQLite ‘C’ API and so operates using SQL statements – there are a number of other posts on this blog talking about it such as this one: SQLite-WinRT: Database programming on Windows Phone and Windows 8

So I settled down today to make sure it worked on UWP. Now most of the time, libraries written for Windows 8.1 Store apps or for Windows Phone 8.1 (WinRT) just work in UWP apps – but not this time. For some reason, when you try to new up an instance of the SQLiteWinRT Database object, we get a FileNotFoundException. That just seems a bit weird, and in these pre-RTM times, I’m not going to burn loads of hours investigating it. So instead, I built a new WinRT component specifically targeting Windows 10 UWP and tested it out – that works!

However, after some hours of trying things out, it appears that currently there’s no way of building a NuGet package that contains unique libraries for Windows 8.1/Windows Phone 8.1 *and* for UWP. That support will come with an update to NuGet as we get nearer to RTM.

So for now, to use SQLite-WinRT in a UWP app you will have to add the project for the wrapper API to your solution. You can download a sample project with the SQLite-WinRT component source included here:

Also, don’t forget to go to Tools – Extensions and Updates in Visual Studio 2015, click Online in the left panel and then search for and install SQLite for Universal  App Platform. Then in your client project, add a reference to SQLite for Universal App Platform from the Add Reference wizard:


Don’t forget, if your app is targeting Windows 8.0/8.1 or Windows Phone 8.1 (WinRT) or 8.0/8.1(Silverlight) you can still just use the existing SQLite-WinRT NuGet package.