System.Data.SQLite.EF6.Migrations: load a wrong version which does not exist (Entity Framework 6, NOT core)

0

I am trying to use code-first approach to configure a .net 4.5 project with libraries of

  • System.Data.SQLite
  • System.Data.SQLite.EF6
  • System.Data.SQLite.EF6.Migrations

I have everything set up successfully in a POC sandbox and it works fine. Following exactly the same configuration in the production project, I have got error raised when using Add-Migration command.

It shows it needs Version=1.0.104.0 but the project is using 1.0.112.1. The corresponding dlls are in bin folder so they are supposed to be read correctly. Plus, I have checked every possible location and ensured all dll files are 1.0.112.1, including GAC and csproj. There should be no place using a wrong version of SQLite.EF6

System.IO.FileLoadException: Could not load file or assembly 'System.Data.SQLite.EF6, Version=1.0.104.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)
File name: 'System.Data.SQLite.EF6, Version=1.0.104.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139'
   at System.Data.SQLite.EF6.Migrations.SQLiteMigrationSqlGenerator..ctor()
   at School.ExcelAddin.Data.SQLiteDB.Configuration..ctor() in C:\School.ExcelAddin.Data.SQLiteDB\Configuration.cs:line 16
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Data.Entity.Migrations.Utilities.MigrationsConfigurationFinder.FindMigrationsConfiguration(Type contextType, String configurationTypeName, Func`2 noType, Func`3 multipleTypes, Func`3 noTypeWithName, Func`3 multipleTypesWithName)
   at System.Data.Entity.Infrastructure.Design.Executor.GetMigrationsConfiguration(String migrationsConfigurationName)
   at System.Data.Entity.Infrastructure.Design.Executor.ScaffoldInternal(String name, DbConnectionInfo connectionInfo, String migrationsConfigurationName, Boolean ignoreChanges)
   at System.Data.Entity.Infrastructure.Design.Executor.Scaffold.<>c__DisplayClass0_0.<.ctor>b__0()
   at System.Data.Entity.Infrastructure.Design.Executor.OperationBase.<>c__DisplayClass4_0`1.<Execute>b__0()
   at System.Data.Entity.Infrastructure.Design.Executor.OperationBase.Execute(Action action)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

Could not load file or assembly 'System.Data.SQLite.EF6, Version=1.0.104.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)
c#
.net
sqlite
asked on Stack Overflow Apr 21, 2020 by hla28

1 Answer

0

I have found a solution myself. System.Data.SQLite.EF6.Migrations from nuget is using a different (older) version of System.Data.SQLite.EF6 and System.Data.SQLite from nuget repository. When newing up a SQLiteMigrationSqlGenerator instance, it points to the older version of System.Data.SQLite.EF6 (v1.0.104.0) which is conflicting the current loaded assembly (1.0.112.1).

answered on Stack Overflow Apr 22, 2020 by hla28

User contributions licensed under CC BY-SA 3.0