When I debug my UWP project I get the following error:
System.IO.FileNotFoundException: 'Could not load file or assembly 'e_sqlite3, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.'
The error occurs on this line:
Xamarin.Forms.Forms.Init(e);
From the following code block:
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
Frame rootFrame = Window.Current.Content as Frame;
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame();
rootFrame.NavigationFailed += OnNavigationFailed;
Xamarin.Forms.Forms.Init(e);
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO: Load state from previously suspended application
}
// Place the frame in the current Window
Window.Current.Content = rootFrame;
}
if (e.PrelaunchActivated == false)
{
if (rootFrame.Content == null)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
rootFrame.Navigate(typeof(MainPage), e.Arguments);
}
// Ensure the current window is active
Window.Current.Activate();
}
}
A little background... I started out with 3 projects in my solution (Shared Library, WPF, and Android). The application is currently reading and writing to a sqlite file in both the Android and WPF projects.
I just added the UWP project. After adding a reference to the shared library and adding the relevant nuget packages I encounter the error when debugging the UWP project.
Here is my Current Solution: Screenshot of Solution Explorer
I am using SQLite-net-pcl nuget version 1.5.231 (the most current stable version at time of posting). Screenshot of nuget package
I also have the SQLiteNetExtensions and SQLiteNetExtensions.Async nuget packages. Screenshot of all sqlite related nuget packages
My UWP project has: Target Version: Windows 10, version 1809 Min Version: Windows 10 Fall Creators Update screenshot of UWP Target settings
I have found a number of posts regarding this issue but they all seem to indicate that this was resolved in SQLite-net-pcl version 1.5.166, and I'm using a newer version.
Another posts mentions using a sqlite extension for visual studio, which I was unable to find. That post was a few years old so the fix might not be relevant since it's referencing Visual Studio 2015.
I am using Visual Studio Professional 2017, Version 15.9.9. Running on a Windows 10 Pro workstation with all of the latest updates and service packs.
Does anyone have any suggestions on how to fix this issue?