System.Data.SQLite ADO.NET Provider cannot be loaded on non development machine

c# dll entity-framework-6 sqlite


I am trying to port an application from EF3.5 using MS-SQL Server to EF6 using SQLite. Currently the application runs fine on my development machine but as soon as I try to deploy it somewhere else (in this case my Installation-Test-VM), it won't load. Instead I get an exception stating that the ADO.NET Provider with the invariant name 'System.Data.SQLite' and the framework provider type 'System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6' could not be loaded.

I get the exception in german, the original text is

Der in der Anwendungskonfigurationsdatei für den ADO.NET-Anbieter mit dem invarianten Namen 'System.Data.SQLite' registrierte Entity Framework-Anbietertyp 'System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6' konnte nicht geladen werden.

I get the same message on the development machine when I remove the SQLite DLLs (System.Data.SQLite.dll and System.Data.SQLite.EF6.dll) from the output directory.

My config file looks like this:

<?xml version="1.0" encoding="utf-8"?>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    <!-- For more information on Entity Framework configuration, visit -->
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <assemblyIdentity name="EntityFramework.MappingAPI" publicKeyToken="7ee2e825d201459e" culture="neutral" />
        <bindingRedirect oldVersion="" newVersion="" />
      <provider invariantName="System.Data.SQLite" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
      <provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
      <remove invariant="System.Data.SQLite.EF6" />
      <add name="SQLite Data Provider (Entity Framework 6)" 
           description=".NET Framework Data Provider for SQLite (Entity Framework 6)" 
           type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
      <remove invariant="System.Data.SQLite" />
      <add name="SQLite Data Provider"
                           description=".NET Framework Data Provider for SQLite"
                           type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />

The connection is build at runtime like this:

EntityConnectionStringBuilder entityBuilder = new EntityConnectionStringBuilder();
entityBuilder.Provider = "System.Data.SQLite"; //I also tried System.Data.SQLite.EF6, same result
entityBuilder.ProviderConnectionString = new SqlConnectionStringBuilder()
    DataSource = "sqlite_master.db" //The idea is that the user will later be able to choose which DB to open via a file chooser
entityBuilder.Metadata = @"res://*/OTDModel.csdl|res://*/OTDModel.ssdl|res://*/OTDModel.msl";
connection = new EntityConnection(entityBuilder.ToString()); //here the exception is thrown
classThatExtendsDbContext dbContext = new classThatExtendsDbContext(connection);

Both DLLs have Local Copy = True and Specific Version = False set in Visual Studio.

I've also tried to use 32bit DLLs on the VM (VM runs a 32bit Win7, dev machine runs 64bit) from the sqlite-netFx451-binary-bundle-Win32-2013- paket. Same result.

Has anyone an idea what could be the cause of that behaviour and how to fix this?


I've dusted off an old development machine which has never been used with SQLite and happens to run Windows 7 64Bit. The application starts without any problem. Now I'm setting up a 64bit VM to see if my problem is limited to 32bit machines.


Using a 64Bit VM doesn't work as well. Same error as usual.

3/24/2016 12:50:44 PM

Accepted Answer

I've now managed to fix the problem.

The solution is to manually install the correct Microsoft Visual C++ Runtime Library from

This helped on both the 32 and the 64bit VM. I used the 2013-x86 version but I guess that you'd have to use the x64 one, if you compile a 64bit application.

1/28/2016 12:10:22 AM

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow