Deploying a SQLite database file with a Xamarin.Forms app–(UWP update)

Say you have a SQLite DB you want to deploy with your Xamarin Forms app. Here is an excellent article on how to do this from Rob Gibbens of Xamarin University fameā€¦

The article has wp8 but it uses Application.GetResourceStream and that is only for Windows phone, and the code below I have updated for UWP. Also, in November the UWP team posted some great sample code where I found the answer at:

So, just replace the WP8 code in the blog article with this code below and you will all set. The iOS and Android code works fine in the blog.

var storageFile = IsolatedStorageFile.GetUserStoreForApplication();

if (!storageFile.FileExists(dbPath))

// copy storage file; replace if exists.
var fileToRead = await Windows.Storage.StorageFile.GetFileFromApplicationUriAsync(new Uri(“ms-appx:///people.db3″, UriKind.Absolute));

Windows.Storage.StorageFolder storageFolder =


StorageFile fileCopy = await fileToRead.CopyAsync(storageFolder, “people.db3″, NameCollisionOption.ReplaceExisting);


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>