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

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

问题描述

我有一个小型C#WinForms应用程序,它是在64位计算机上的Windows 8.1上使用Visual Studio Community 2015开发的,目标是.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?

感谢您的帮助。史蒂夫(Steve)

Thanks for any help. Steve

推荐答案

我刚刚找到了一个可行的解决方案。阅读概述的评论 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天全站免登陆