当我调试我的 UWP 项目时,我收到以下错误:
System.IO.FileNotFoundException:'无法加载文件或程序集'e_sqlite3,Culture=neutral,PublicKeyToken=null'。该系统找不到指定的文件。'
错误发生在这一行:
Xamarin.Forms.Forms.Init(e);
从以下代码块:
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();
}
}
一点背景知识...我的解决方案中开始使用 3 个项目(共享库、WPF 和 Android)。该应用程序当前正在读取和写入 Android 和 WPF 项目中的 sqlite 文件。
我刚刚添加了 UWP 项目。添加对共享库的引用并添加相关的 nuget 包后,我在调试 UWP 项目时遇到错误。
这是我当前的解决方案: 解决方案资源管理器的屏幕截图
我正在使用 SQLite-net-pcl nuget 版本 1.5.231(发布时最新的稳定版本)。 nuget包截图
我也有 SQLiteNetExtensions 和 SQLiteNetExtensions.Async nuget 包。 所有 sqlite 相关 nuget 包的屏幕截图
我的 UWP 项目有: 目标版本:Windows 10,版本 1809 最低版本:Windows 10 Fall Creators Update UWP 目标设置截图
我发现了很多关于这个问题的帖子,但它们似乎都表明这已在 SQLite-net-pcl 版本 1.5.166 中得到解决,并且我正在使用更新的版本。
另一篇文章提到使用 Visual Studio 的 sqlite 扩展,我无法找到。那篇文章已经有几年了,所以修复可能不相关,因为它引用了 Visual Studio 2015。
我正在使用 Visual Studio Professional 2017,版本 15.9.9。在具有所有最新更新和服务包的 Windows 10 Pro 工作站上运行。
有人对如何解决此问题有任何建议吗?