View Ticket
Not logged in
Ticket UUID: 2935cb31d05d125463cee65b0f2296874d383143
Title: Unable to load SQLite.Interop.dll - Click Once Deployed App
Status: Closed Type: Incident
Severity: Important Priority: Medium
Subsystem: NuGetPackage Resolution: Works_As_Designed
Last Modified: 2016-05-06 00:46:25
Version Found In: 1.0.101
User Comments:
anonymous added on 2016-05-02 21:34:52:
There might have been a problem when I tried to submit this an hour or so ago and I don't see it in All Tickets, so I'm submitting again.

I have a small C# WinForms app developed using Visual Studio Community 2015
on Windows 8.1 on a 64-bit computer. My VS project properties target .Net Framework 4.5.2 and Any CPU | Prefer 32-bit.  
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.  I just reinstalled fresh copies as a precaution.

The app runs fine in the VS debugger, but the ClickOnce published version gets the error in the title when installed and run on the same computer.  I have skeptically tried several fixes I found online [(1) installing System.Data.SQLite.Core.MSIL using NuGet; and (2) manually adding some <PropertyGroup> code to the .csproj file, which may have been removed on Build/Publish] to no avail.  

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 if that matters.  All 3 of the SQLite dlls in the project references have Copy Local = true.

Is it me or something else?

mistachkin added on 2016-05-04 13:43:49:
I'm not exactly sure how ClickOnce integrates with MSBuild; however, there are
build tasks in the NuGet package designed to copy the native libraries.  Perhaps
they are not being called?

anonymous (claiming to be added on 2016-05-05 13:04:11:
Perhaps you are right and the NuGet build tasks are not being called.  Unfortunately, that doesn't tell me what to do. I'm guessing the SQLite team controls the NuGet setup for SQLite.

I've tried to add a reference to SQLite.Interop.dll to the project, but get an error saying it could not be added because it may not be accessible or is not a valid assembly or COM component.  I've also looked at the ClickOnce manifest and there is no mention of SQLite.Interop.dll, which I would think is clearly a problem.

Is there anything you can do to help me?  I'm surprised this isn't a problem many others would be having since I'm using a very recently installed version of Visual Studio Community 2015 and following what I understand to the recommended way to incorporate SQLite into my app.

Thanks for any help you can provide.  Steve

P.S.  Is there any way for me to be notified when you post a response?

anonymous (claiming to be added on 2016-05-05 13:32:20:
OK.  It finally sunk in and I got it to work.  I'm obviously still learning what I need to do to make all the technologies (VS, ClickOnce, SQLite, etc) fit together.

The solution was to add the dll to my VS project, not as a reference, but simply as a file and to set its Copy to Output Directory property to Copy if newer.  This hit me after re-reading the  SQLite FAQs (which I had done before).  

I don't know if this is possible, but my suggestion would be for the SQLite team to configure NuGet to do that automatically since, I presume, that's always a requirement (even though I don't know what SQLite.Interop does).

Anyway, thanks for responding to my initial post.