[英]System.Data.SQLite.EF6.Migrations: load a wrong version which does not exist (Entity Framework 6, NOT core)
I am trying to use code-first approach to configure a .net 4.5 project with libraries of我正在尝试使用代码优先的方法来配置带有库的 .net 4.5 项目
I have everything set up successfully in a POC sandbox and it works fine.我在 POC 沙箱中成功设置了所有内容,并且运行良好。 Following exactly the same configuration in the production project, I have got error raised when using Add-Migration command.在生产项目中遵循完全相同的配置,使用 Add-Migration 命令时出现错误。
It shows it needs Version=1.0.104.0 but the project is using 1.0.112.1.它显示它需要版本 = 1.0.104.0,但项目使用的是 1.0.112.1。 The corresponding dlls are in bin folder so they are supposed to be read correctly.相应的 dll 位于 bin 文件夹中,因此应该可以正确读取它们。 Plus, I have checked every possible location and ensured all dll files are 1.0.112.1, including GAC and csproj.另外,我检查了所有可能的位置,并确保所有 dll 文件都是 1.0.112.1,包括 GAC 和 csproj。 There should be no place using a wrong version of SQLite.EF6 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)
I have found a solution myself.我自己找到了解决方案。 System.Data.SQLite.EF6.Migration s from nuget is using a different (older) version of System.Data.SQLite.EF6 and System.Data.SQLite from nuget repository. System.Data.SQLite.EF6.Migration s 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).更新SQLiteMigrationSqlGenerator实例时,它指向与当前加载的程序集 (1.0.112.1) 冲突的旧版本System.Data.SQLite.EF6 (v1.0.104.0)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.