SQLite deployment for .net application

前端 未结 4 437
清酒与你
清酒与你 2020-12-09 18:21

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 in

相关标签:
4条回答
  • 2020-12-09 18:34

    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>
    
    0 讨论(0)
  • 2020-12-09 18:35

    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#

    0 讨论(0)
  • 2020-12-09 18:39

    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.

    0 讨论(0)
  • 2020-12-09 18:58

    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

    0 讨论(0)
提交回复
热议问题