如何使用 ClickOnce 发布带有 SQLite 的 Winforms 应用程序 [英] How to Publish a Winforms App with SQLite using ClickOnce

查看:44
本文介绍了如何使用 ClickOnce 发布带有 SQLite 的 Winforms 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用 Visual Studio Community 2015 在 64 位计算机上的 Windows 8.1 上开发的小型 C# WinForms 应用程序,目标是 .Net Framework 4.5.2 和任何 CPU |首选 32 位.(我也尝试只针对 x86).

I have a small C# WinForms app developed using Visual Studio Community 2015 on Windows 8.1 on a 64-bit computer and targeting .Net Framework 4.5.2 and Any CPU | Prefer 32-bit. (I also tried targeting just x86).

我使用 NuGet 包管理器安装 Entity Framework 6.3.1 和 System.Data.SQLite 1.0.101(安装了 System.Data.SQLite、System.Data.SQLite.Core、System.Data.SQLite.EF6 和System.Data.SQLite.Linq),虽然 System.Data.SQLite.Core 没有显示在项目参考中.

I used NuGet Package Manager to install Entity Framework 6.3.1 and System.Data.SQLite 1.0.101 (which installed System.Data.SQLite, System.Data.SQLite.Core, System.Data.SQLite.EF6, and System.Data.SQLite.Linq), though System.Data.SQLite.Core doesn't show in the project references.

应用在 VS 调试器中运行良好,但 ClickOnce 发布版本在安装并在同一台计算机上运行时触发无法加载 SQLite.Interop.dll 异常.

The app runs fine in the VS debugger, but the ClickOnce published version triggers an Unable to load SQLite.Interop.dll exception when installed and run on the same computer.

我在解决方案资源管理器中没有看到对 SQLite.Interop.dll 的任何引用.在项目的 x86 和 x64 Debug 文件夹中都有这样的 dll,但在空的 Release 文件夹中没有.当我尝试添加对 x86 或 x64 dll 的引用时,我收到一条错误消息,指出无法添加它们(即无法访问或不是有效的程序集或 COM 组件).项目引用中的所有 3 个 SQLite dll 都具有 Copy Local = true.

I don't see any references to SQLite.Interop.dll in Solution Explorer. There are such dlls in both the x86 and x64 Debug folders of the project, but not in the Release folder which is empty. When I try to add a reference to either the x86 or x64 dlls, I get an error saying they could not be added (i.e. inaccessible or not a valid assembly or COM component). All 3 of the SQLite dlls in the project references have Copy Local = true.

我猜 SQLite NuGet 安装未能设置某些项目属性/引用,但我不知道这可能是什么、为什么以及如何解决它.我什至不确定谁该负责:SQLite、NuGet、Visual Studio 还是我?

I'm guessing the SQLite NuGet install failed to set some project property/reference, but I don't know what that might be, why, and how to get around it. I'm not even sure who's responsible: SQLite, NuGet, Visual Studio, me?

感谢您的帮助.史蒂夫

推荐答案

我刚刚找到了一个可行的解决方案.阅读概述的评论 https://github.com/oysteinkrog/SQLite.Net-PCL/issues/158#issuecomment-88163499 <-那里

I JUST found a working solution. Read the comment outlined https://github.com/oysteinkrog/SQLite.Net-PCL/issues/158#issuecomment-88163499 <- there

重要部分:

我为 x86 和 x64 创建了新的 PROJECT 文件夹.我在单击一次部署的项目中创建了项目文件夹.也就是说,生成可执行文件的项目.我将 bin 文件夹中的互操作文件复制到新的解决方案文件夹中

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

这篇关于如何使用 ClickOnce 发布带有 SQLite 的 Winforms 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆