mercredi 4 mai 2016

How to Publish a Winforms App with SQLite using ClickOnce

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).

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.

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.

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.

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?

Thanks for any help. Steve

Aucun commentaire:

Enregistrer un commentaire