6

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?

haldo
  • 14,512
  • 5
  • 46
  • 52
  • Have you tried SQLite-net-pcl version 1.5.166 instead of the newer version? – AbbyWang - MSFT Mar 19 '19 at 09:00
  • I've seen this problem come and go a few times now. I still have no idea what changes to fix / unfix this. Adding SQLite-net-pcl does not help.Changing all my packages from packages.config files to project based seemed to fix it the first time i saw it. (right click option on the project to do this). BTW e_sqlite3 does exist. – Menace May 23 '19 at 21:19

0 Answers0