简体   繁体   English

System.Data.SQLite.EF6.Migrations:加载不存在的错误版本(实体框架 6,非核心)

[英]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 项目

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

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.

相关问题 实体框架:在 Net Core 中为先前版本运行 EF 迁移 - Entity Framework: Run EF Migrations for Previous Version in Net Core EF迁移生成包含不再存在的数据的迁移文件 - EF Migrations generates a migrations file with data that does not exist anymore System.Data.Sqlite是否支持实体框架6? - Does System.Data.Sqlite support Entity Framework 6? 在 ASP.NET Core 中使用 EF Core 加载单个实体及其相关数据的更好方法是什么? - Which is the better way to load a single entity with its related data with EF Core in ASP.NET Core? 测试实体框架核心迁移 - Testing Entity Framework Core Migrations Entity Framework Core 和 EF6 - dotnet ef 迁移添加 InitialCreate - 值不能为空。 (参数“连接字符串”) - Entity Framework Core and EF6 - dotnet ef migrations add InitialCreate - Value cannot be null. (Parameter 'connectionString') 使用迁移与实体框架核心 - Using Migrations with Entity Framework Core 为什么实体框架System.Data.Entity.Core.Objects.RelationshipEntry错误? (用于变更跟踪) - Why is the Entity Framework System.Data.Entity.Core.Objects.RelationshipEntry Wrong? ( For Change Tracking) EF7使用SQLite生成错误的迁移 - EF7 generates wrong migrations with SQLite 在Entity Framework Core中为SQLite使用数据注释 - Using Data Annotations for SQLite in Entity Framework Core
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM