如何使用 ClickOnce 使用 SQLite 发布 Winforms 应用程序
How to Publish a Winforms App with SQLite using ClickOnce
我有一个小型 C# WinForms 应用程序,使用 Visual Studio Community 2015 在 Windows 8.1 上在 64 位计算机上开发,目标是 .Net Framework 4.5.2 和任何 CPU |首选 32 位。 (我也试过只针对 x86)。
我使用 NuGet 包管理器安装了 Entity Framework 6.3.1 和 System.Data.SQLite 1.0.101(其中安装了 System.Data.SQLite、System.Data.SQLite.Core、[=23= .EF6 和 System.Data.SQLite.Linq),但 System.Data.SQLite.Core 未显示在项目引用中。
应用程序 运行 在 VS 调试器中运行良好,但 ClickOnce 发布版本在安装时触发无法加载 SQLite.Interop.dll 异常并且 运行 在同一台计算机上。
我在解决方案资源管理器中没有看到任何对 SQLite.Interop.dll 的引用。在项目的x86和x64 Debug文件夹中都有这样的dll,但在空的Release文件夹中没有。当我尝试添加对 x86 或 x64 dll 的引用时,我收到一条错误消息,指出无法添加它们(即无法访问或不是有效的程序集或 COM 组件)。项目引用中的所有 3 个 SQLite dll 都具有 Copy Local = true。
我猜 SQLite NuGet 安装未能设置某些项目 property/reference,但我不知道那可能是什么、为什么以及如何解决它。我什至不确定谁该负责:SQLite、NuGet、Visual Studio、我?
感谢您的帮助。史蒂夫
我刚刚找到了一个可行的解决方案。阅读概述的评论 https://github.com/oysteinkrog/SQLite.Net-PCL/issues/158#issuecomment-88163499 <- 那里
重要部分:
I created new PROJECT folders for x86 and x64. I created the project folders in the project that click-once deploys. That is, the project that produces the executable. I copied the interop files from the bin folder into the new solution folders
只需在您的 solition 资源管理器中包含 x86 和 x64 文件夹。然后将 Copy 设置为 local=true。我将使用 sqlite.interop.dll
创建文件夹
遇到了类似的问题,通过在我的启动项目中简单地创建 x64 和 x86 文件夹解决了这个问题,如下所示:
- 我正在使用一个单独的 class 库项目与 sqlite 数据库通信。这是我从
复制 sqlite.interop.dll 文件的地方
我有一个小型 C# WinForms 应用程序,使用 Visual Studio Community 2015 在 Windows 8.1 上在 64 位计算机上开发,目标是 .Net Framework 4.5.2 和任何 CPU |首选 32 位。 (我也试过只针对 x86)。
我使用 NuGet 包管理器安装了 Entity Framework 6.3.1 和 System.Data.SQLite 1.0.101(其中安装了 System.Data.SQLite、System.Data.SQLite.Core、[=23= .EF6 和 System.Data.SQLite.Linq),但 System.Data.SQLite.Core 未显示在项目引用中。
应用程序 运行 在 VS 调试器中运行良好,但 ClickOnce 发布版本在安装时触发无法加载 SQLite.Interop.dll 异常并且 运行 在同一台计算机上。
我在解决方案资源管理器中没有看到任何对 SQLite.Interop.dll 的引用。在项目的x86和x64 Debug文件夹中都有这样的dll,但在空的Release文件夹中没有。当我尝试添加对 x86 或 x64 dll 的引用时,我收到一条错误消息,指出无法添加它们(即无法访问或不是有效的程序集或 COM 组件)。项目引用中的所有 3 个 SQLite dll 都具有 Copy Local = true。
我猜 SQLite NuGet 安装未能设置某些项目 property/reference,但我不知道那可能是什么、为什么以及如何解决它。我什至不确定谁该负责:SQLite、NuGet、Visual Studio、我?
感谢您的帮助。史蒂夫
我刚刚找到了一个可行的解决方案。阅读概述的评论 https://github.com/oysteinkrog/SQLite.Net-PCL/issues/158#issuecomment-88163499 <- 那里
重要部分:
I created new PROJECT folders for x86 and x64. I created the project folders in the project that click-once deploys. That is, the project that produces the executable. I copied the interop files from the bin folder into the new solution folders
只需在您的 solition 资源管理器中包含 x86 和 x64 文件夹。然后将 Copy 设置为 local=true。我将使用 sqlite.interop.dll
创建文件夹遇到了类似的问题,通过在我的启动项目中简单地创建 x64 和 x86 文件夹解决了这个问题,如下所示:
- 我正在使用一个单独的 class 库项目与 sqlite 数据库通信。这是我从 复制 sqlite.interop.dll 文件的地方