Could not load file or assembly 'System.Data.SQLite' when using with EF 6

.net-assembly c# entity-framework-6 sqlite


I have created a simple console application using VS 2013 and .Net 4.5 framework. I am trying to achieve a very simple objective of using Entity Framework & SQLite, I wish to create a table from my model, using the code-first approach. I have installed the NuGet package to be able to use LINQ to SQLite in my project.

Below is the code of my application:

 static void Main(string[] args)
     string _databaseFilePath = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "TestSqliteDb.sdb");

     if (!File.Exists(_databaseFilePath))

     using (var testDb = new TestMovieDbContext())
             new ApplicationConfiguration
                 ConfigKey = "CreatedDate",
                 ConfigValue = "12-03-2015"

public class TestMovieDbContext : DbContext
    public TestMovieDbContext()
        : base("name=TestDbConStr")

    public DbSet<ApplicationConfiguration> AppConfigTable { get; set; }

public class ApplicationConfiguration
    public string ConfigKey { get; set; }
    public string ConfigValue { get; set; }

So, here I'm simply trying to add a new ApplicationConfiguration obj to the AppConfig DbSet of the DbContext.

However, at the time of executing the Add method line, the application throws the below exception:

System.IO.FileLoadException was caught
  Message=Could not load file or assembly 'System.Data.SQLite, Version=, Culture=neutral, PublicKeyToken=db937bc2d44ff139' or one of its dependencies. The located assembly`s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
  FileName=System.Data.SQLite, Version=, Culture=neutral, PublicKeyToken=db937bc2d44ff139
  FusionLog==== Pre-bind state information ===
LOG: DisplayName = System.Data.SQLite, Version=, Culture=neutral, PublicKeyToken=db937bc2d44ff139
LOG: Appbase = file:///E:/Projects/TestApplications/LinqToSqliteDemo/LinqToSqliteDemo/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : System.Data, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089.
> LOG: This bind starts in default load context.
LOG: Using application configuration file: E:\Projects\TestApplications\LinqToSqliteDemo\LinqToSqliteDemo\bin\Debug\LinqToSqliteDemo.vshost.exe.Config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: System.Data.SQLite, Version=, Culture=neutral, PublicKeyToken=db937bc2d44ff139
LOG: Attempting download of new URL file:///E:/Projects/TestApplications/LinqToSqliteDemo/LinqToSqliteDemo/bin/Debug/System.Data.SQLite.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Build Number
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
3/13/2015 6:58:45 PM

Popular Answer

I am using EF 6.1.3, SQLite and SQLite.CodeFirst on Visual Studio 2013 Update 4 without such issues. Try updating.

4/16/2015 2:59:06 PM

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