5
votes

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

3
I'm having the exact same issue. I'll go on to further add that I've tried installing the c++ redistributeable package with my clickonce solution to no avail. There are a number of solutions to this same problem from years ago, but nothing that actually solves the problem for me - MrNickel

3 Answers

9
votes

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

Important piece:

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

1
votes

Just include x86 and x64 folders in your solition explorer. Then set Copy to local=true. I will create folders with sqlite.interop.dll

0
votes

Had a similar issue, resolved it by simly creating the x64 and x86 folder on my startup project as follows:

Including sqlite.interop.dll in wpf clickonce app

  • I am using a separate class library project to communicate with the sqlite db. This is where I copied the sqlite.interop.dll files from