14

I have used SQLite for my .net framework 4.0 WPF application, It works perfectly fine with development environment. I just copied system.data.sqlite.dll to my application installed location but it is not working as expected.

Can anybody tell me how to deploy the SQLite for the fresh machine.?

IS it not enough to distribute only the dll's? I am using installshiled 2011 to build the setup installer. Please share if anybody has merge module for SQLite.

Early help will be greatly appreciated.

Thanks in advance

Vinay MS

Vinay MS
  • 550
  • 3
  • 6
  • 21
  • is everything the same in terms of x86/x64? – Daniel A. White Oct 07 '11 at 15:01
  • 4
    What does *not working* mean? – D'Arcy Rittich Oct 07 '11 at 15:01
  • 3
    how is it not working as expected? – Daniel A. White Oct 07 '11 at 15:01
  • also consider a permission problem. try running you executable with admin priviliges to see if it works that way. without more details, we can't help you. – Emir Akaydın Oct 07 '11 at 15:07
  • I am sorry for not giving more error info..I have used WCF data service to access the sql lite database.. It gives compilation error Error 175: The specified store provider cannot be found in the configuration, or is not valid. though i can run the application but I cant save the data to the data base...application getting crashed.. – Vinay MS Oct 08 '11 at 05:09
  • Possible duplicate of [how to deploy sqlite with .Net](http://stackoverflow.com/questions/3728175/how-to-deploy-sqlite-with-net) – NoWar Mar 03 '16 at 12:00

4 Answers4

7

You should be able to operate with just the interop and the data DLLs. Our project uses these:
Note: we are using LINQ as well.

The LINQ one isn't necessary unless you use LINQ.

I've renamed every copy of SQLite3.dll or SQLite3.exe on my computer (there were dozens) and the application continues to run. I was checking to make sure my answer is correct, and this is something we're going to have to do, in order to make sure our installs work, too.

Tangurena
  • 2,121
  • 1
  • 22
  • 41
6

What Tangurena says is right (which in fact helped me to get it working) but you also need to include the config setting mentioned in the readme of SQLite:

<system.data>
    <DbProviderFactories>
        <remove invariant="System.Data.SQLite" />
        <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite"
             type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite, Version=1.0.80.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
    </DbProviderFactories>
</system.data>
kzfabi
  • 2,065
  • 1
  • 22
  • 26
1

Actually, you should be able to just copy System.Data.SQLite.dll from your project. I typically set the CopyLocal property to true when I add that reference to my projects, and then make sure that when I make an installer I have that DLL in the same location as the final .exe file. I wrote a blog post about this last year, maybe something in my post will set you on the right track: My Blog Post on SQLite and C#

Brendon Dugan
  • 2,138
  • 7
  • 31
  • 65
0

As some mentioned earlier you need to include to your app configuration:

<system.data>
<DbProviderFactories>
    <remove invariant="System.Data.SQLite" />
    <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite"
         type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite, Version=1.0.80.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
</DbProviderFactories>

You have to also add DLL files to references:

  • SQLite.Designer
  • System.Data.SQLite
  • System.Data.SQLite.Linq

And set property 'Copy Local' value equal true for each of them. Please visit my blog for more info

Łukasz
  • 31
  • 1
  • 3