Thanks to Tim Heuer I’ve found that there’s an easier way to add SQLite to your Windows 8 application rather than the manual one described in my post. Now SQLite for WinRT is available as a Visual Studio extension, you can simply add it by searching for the keyword sqlite: the name of the extension is SQLite for Windows Runtime. Once you’ve installed it and restarted Visual Studio, you can now simply add SQLite to your application by adding a reference to two of the available libraries in the Extensions panel: Microsoft Visual C++ Runtime Package and SQLite for Windows Runtime. You can access to the panel by right clicking on the project, choosing Add reference and selecting Extensions from the Windows menu.
Be aware that, since the library uses C++ extensions, you can’t compile the application using as a platform the Any CPU option, but you should target a specific platform. To do that, open the Configuration manager from the Build menu and set the platform to one of the available options (x86, x64 or ARM).
If you don’t do this, you’ll see a warning sign on the two references Microsoft Visual C++ Runtime Package and SQLite for Windows Runtime and the project won’t compile.
And… you’re done! No more manually downloading the dll library and copying it to the Visual Studio project: you can simply go on, install sqlite-net and use the same code you’ve learned to use in my first post.
Thanks to Tim Heuer for the tip and… happy coding!