System.Data.SQLite

Login
This project makes use of Eagle, provided by Mistachkin Systems.
Eagle: Secure Software Automation
Ticket Hash: 2a09baf70cf1f738497b3bd4d44c61bfbb7238b7
Title: Conflicting providers between design-time setup and NuGet package
Status: Closed Type: Incident
Severity: Important Priority: Medium
Subsystem: VsDesignerInstaller Resolution: Fixed
Last Modified: 2014-06-03 03:00:07
Version Found In: 1.0.92
User Comments:
anonymous added on 2014-04-01 19:56:49: (text/x-fossil-plain)
Installed sqlite-netFx451-setup-bundle-x86-2013-1.0.92.0.exe and the provider is correctly added to VS2013 so I can create and connect to a database.

In a project I add System.Data.Sqlite (x86/x64) from nuget and these packages are installed:

<package id="EntityFramework" version="6.0.2" targetFramework="net451" />
  <package id="System.Data.SQLite" version="1.0.92.0" targetFramework="net451" />
  <package id="System.Data.SQLite.Core" version="1.0.92.0" targetFramework="net451" />
  <package id="System.Data.SQLite.EF6" version="1.0.92.0" targetFramework="net451" />
  <package id="System.Data.SQLite.Linq" version="1.0.92.0" targetFramework="net451" />

When I start the wizard "ADO.NET Entity Data Model" a message say that is not possible to find a compatible provider.

I see that connection strings point to System.Data.SQLite instead System.Data.SQLite.EF6.

If I change in app.config 

<Provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />

in 

<provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.SQLiteProviderServices, System.Data.SQLite.EF6" />

I get System.Data.Entity.Core.ProviderIncompatibleException (ADO.NET provider with invariant name "System.Data.SQLite.EF6" is either not registered in machine or application config file, or could not be loaded.)

I tried every trick found on internet but nothing works.

mistachkin added on 2014-04-01 22:48:20: (text/x-fossil-plain)
Installing the setup package should not be necessary to make use of the EF6
support.  Currently, it is not possible to use the design-time components
for Visual Studio with the NuGet package on the same machine.

anonymous added on 2014-04-02 17:06:28: (text/x-fossil-plain)
I apologize, I'm not sure I understand the reply. Please, note that I'm not the original poster.

Are you suggesting that we install the package with design-time components on the developer machines, and not use the NuGet libraries at all? Would we set our references in the project to point to the libraries in the GAC? Would it be possible to setup our build machine such that it pulls the libraries from NuGet?

Are there plans to update the NuGet package to be compatible with the design-time components?

I also have Visual Studio 2013, Entity Framework 6.0.2, and System.Data.SQLite 1.0.92.0

mistachkin added on 2014-04-02 19:29:32: (text/x-fossil-plain)
Based on my experience, there are some limitations imposed by Visual Studio on
installed design-time packages, mainly that assemblies used by the primary package assembly (e.g. "SQLite.Designer.dll") must be located in the GAC.

In order to be able to support Entity Framework 6 with the installed design-time
package, the Entity Framework 6 assembly would need to be in the GAC as well.
Unfortunately, the deployment guidelines for Entity Framework 6 do not permit
this.

anonymous added on 2014-05-08 16:29:36: (text/x-fossil-plain)
Firstly, I assume we are talking about the problem in the screenshot here
http://social.msdn.microsoft.com/Forums/en-US/6a73f58f-4e71-453a-abf2-37e49e7db535/sqlite-vs2012-ef6-code-first?forum=Offtopic

Based on the replies, I tried to remove the nuget (v1.0.92) and instead added all the refs manually that I could find to be relevant, but it still did not work, same error?

The refs that I added through the Visual Studio Add Reference dialog were:
C:\Program Files (x86)\System.Data.SQLite\2013\bin\EntityFramework.dll
C:\Program Files (x86)\System.Data.SQLite\2013\bin\System.Data.SQLite.dll
C:\Program Files (x86)\System.Data.SQLite\2013\bin\System.Data.SQLite.EF6.dll
C:\Program Files (x86)\System.Data.SQLite\2013\bin\System.Data.SQLite.Linq.dll
and just in case
C:\Program Files (x86)\System.Data.SQLite\2013\bin\SQLite.Designer.dll



I also tried the refs from GAC folder rather than bin, but still did not work:
C:\Program Files (x86)\System.Data.SQLite\2013\GAC\System.Data.SQLite.dll
C:\Program Files (x86)\System.Data.SQLite\2013\GAC\System.Data.SQLite.Linq.dll
(and changed copy local to true just in case)


As well as adding the same things into app.config that the nuget installer did (see p.p.p.s)



I need to create a model (edmx file) from an existing sqlite database and would like to use the Visual Studio wizard for that purpose.. I dont really know what is needed, could you advise if there is a way to make it work? 



p.s. the steps i followed are pretty much all in the following two links, except for using the most up to date 4.5.1 setup that should be the only one that works with Visual Studio 2013

http://geekswithblogs.net/danielggarcia/archive/2013/12/22/portable-databases-using-sqlite-with-.net.aspx

http://geekswithblogs.net/danielggarcia/archive/2013/12/22/portable-databases-ii-using-sqlite-with-entity-framework.aspx




p.p.s. removing nuget removed the following entries from the csproj file



<Reference Include="EntityFramework">
      <HintPath>packages\EntityFramework.6.0.0\lib\net45\EntityFramework.dll</HintPath>
    </Reference>
    <Reference Include="EntityFramework.SqlServer">
      <HintPath>packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
    </Reference>


<Reference Include="EntityFramework.SqlServer">
      <HintPath>packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
    </Reference>


<Reference Include="System.Data.SQLite">
      <HintPath>packages\System.Data.SQLite.Core.1.0.92.0\lib\net451\System.Data.SQLite.dll</HintPath>
    </Reference>
    <Reference Include="System.Data.SQLite.EF6">
      <HintPath>packages\System.Data.SQLite.EF6.1.0.92.0\lib\net451\System.Data.SQLite.EF6.dll</HintPath>
    </Reference>
    <Reference Include="System.Data.SQLite.Linq">
      <HintPath>packages\System.Data.SQLite.Linq.1.0.92.0\lib\net451\System.Data.SQLite.Linq.dll</HintPath>
    </Reference>


<ItemGroup>
    <Content Include="x64\SQLite.Interop.dll">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
    <Content Include="x86\SQLite.Interop.dll">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
  </ItemGroup>



p.p.p.s

      <configSections>
        <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
        <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
      </configSections>


<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" />
        <remove invariant="System.Data.SQLite.EF6" />
        <add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".Net Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
      </DbProviderFactories>
    </system.data>
    <entityFramework>
      <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
        <parameters>
          <parameter value="v11.0" />
        </parameters>
      </defaultConnectionFactory>
      <providers>
        <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
        <provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
      </providers>
    </entityFramework>

anonymous added on 2014-05-09 09:28:29: (text/x-fossil-plain)
got much more info and help from here
http://stackoverflow.com/questions/21757843/system-data-sqlite-1-0-91-0-and-ef6-0-2

but new error now : System.Data.Entity.Core.ProviderIncombatibleException

mistachkin added on 2014-05-09 17:34:00: (text/x-fossil-plain)
The confusion with the configuration file sections should mostly be cleared up
by trunk check-in [c4216e296b6fe91decac6646b6d2a4118e6a852d], which will be part
of release 1.0.93.0.  In the meantime, using 1.0.92.0 with manually modified
configuration files (i.e. to point to the EF6 provider) is recommended.

mistachkin added on 2014-06-03 02:58:10: (text/x-fossil-plain)
This scenario appears to work as of trunk (which will eventually become 1.0.93.0).

mistachkin added on 2014-06-03 03:00:07: (text/x-fossil-plain)
Also see ticket [3c00ec5b52].