0

I've got a component-based app, build with visual studio in c#. There are a UI and a Data component. The data component access a sqlite database. In the IDE I can start the program, so UI appears and everything works. But if I want to deploy the app with ClickOnce, Installing works, but the app doesn't make a move. There's also no error in the logfile.

I tried several ways and found out, it has to be something with SQLite, because if i deploy the app without using a connection to the database, it works.

Maybe it is a problem with the SQLite.Interop.dll, because when i wrote the unittests, they also cant load this dll. I manually have to put it in the right unittest-project-folder. Installing the interop.dll with NuGet also throws errors.

With the code i don't anything special. Here's a short example. Sorry for using german names.

internal class Daten : IDBAnforderungen
{
    private SQLiteConnection _conn;

    public Daten()
    {
        _conn = new SQLiteConnection("Data Source=c:/Datenbank/mydb.sqlite; Version = 3;");
    }

Edit: Visual Studio C# - SQLite.Interop.dll not found

In this thread there is an exception. But i got nothing, when starting.

Edit:

My solution simply was, to switch to MySQL. So there was no problems then.

Dip Hasan
  • 225
  • 3
  • 9
  • 1
    Try wrapping the _conn = new ... inside of a try catch block ... odds are it's blowing up there and falling through any logging. I would also say to add a logging statement to the catch. – Tony Abrams Oct 22 '19 at 10:50
  • 2
    Possible duplicate of [Visual Studio C# - SQLite.Interop.dll not found](https://stackoverflow.com/questions/38594837/visual-studio-c-sharp-sqlite-interop-dll-not-found). Though not specifically for ClickOnce, I suspect the cause is the same - that of missing SQLite dlls. Be sure to add them explicitly to ClickOnce –  Oct 22 '19 at 10:56
  • After installation, are the interop dlls and C:\Datenbank\mydb.sqlite present? – Fildor Oct 22 '19 at 11:01
  • @TonyAbrams i tried, nothing changed. – mseaforest Oct 22 '19 at 11:23
  • @MickyD How can i do that? I just tried to install the same system.data.sqlite packages to the mainproject, which is the one i deploy together with its dependecies. Im not sure its about interop.dll – mseaforest Oct 22 '19 at 11:34
  • @Fildor the C:\Datenbank\mydb.sqlite is present, because it is all the time. In my installation documentation the user has to put it manually there. In the "Application Files"-folder there is no interop.dll. I manuall add them, but no effect. I think it would throw an exception, when it was the interop.dll – mseaforest Oct 22 '19 at 11:38
  • _"How can i do that?"_ - ClickOnce has a tendency not to include 2nd+ degree dependencies. _[How to: Specify which files are published by ClickOnce](https://learn.microsoft.com/en-us/visualstudio/deployment/how-to-specify-which-files-are-published-by-clickonce?view=vs-2019)_ –  Oct 22 '19 at 22:07
  • Here is a thread may help you. [How to Publish a Winforms App with SQLite using ClickOnce](https://stackoverflow.com/questions/37038929/how-to-publish-a-winforms-app-with-sqlite-using-clickonce) – 大陸北方網友 Oct 23 '19 at 02:06

0 Answers0