7

I have generated my model from SQLLite in my Application , but when i try to call DBContext Call it's throwing an exception.

An exception of type System.IO.FileLoadException occurred in mscorlib.dll but was not handled in user code

Additional information: Could not load file or assembly 'System.Data.SQLite.EF6, Version=1.0.93.0, 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)

Please help me.

Tharif
  • 13,794
  • 9
  • 55
  • 77
Joby James
  • 429
  • 8
  • 22
  • What is your application Asp.Net, Windows Forms, WP8? – Atilla Ozgur Jul 20 '15 at 20:15
  • 3 Layers, Front end is (MVC)Asp.net, Data get from (Web API) middle end, Web API connected to the (Class Library) where the SQL Lite Connected to the Code First. – Joby James Jul 21 '15 at 07:55
  • @Joby Did you have a look at http://stackoverflow.com/questions/93879/hresult-0x80131040-the-located-assemblys-manifest-definition-does-not-match-t? – hagello Jul 26 '15 at 19:56

3 Answers3

0

Control your WebApi and Asp.Net MVC projects output bin directories to see that if they actually have System.Data.SQLite.EF6.dll.

Most probably they do not have this dll and you need to set Copy Local property for this dll.

Atilla Ozgur
  • 14,339
  • 3
  • 49
  • 69
0

I had faced similar issue in the past. The issue in my case was that I was adding the same dll from file system and then had a nuget package as well as for the same component.

In your case I can see you have a nuget package of different version "System.Data.SQLite.EF6.1.0.97.0". I would do the below
a. Remove all the references (static dlls if there are any).
b. Add the references from the nuget package.


BTW, the sln file you sent doesn't have csproj (so can't open the proj files).

Lalit Singh Rana
  • 137
  • 1
  • 1
  • 10
0

Before going into solution let me explain to you about the errors that you are facing right now :

System.IO.FileLoadException :

The exception that is thrown when a managed assembly is found but cannot be loaded.

mscorlib :

Microsoft Core Library, ie they are at the heart of everything

Ref-Def-Mismatch:

This exception is thrown when there is an assembly that does not match what you are looking for. A very common mismatch is version number,which is the case here.

You should clean up the config and provide the necessary Entity Framework Providers .

More reference here

Community
  • 1
  • 1
Tharif
  • 13,794
  • 9
  • 55
  • 77