EF 7 Beta 8 - > EF7 RC1 - 不再可以创建迁移

时间:2015-11-21 16:49:09

标签: asp.net-core entity-framework-core

尝试将现有项目从beta 8更改为RC1后,我在运行dnx ef migrations add Init

后得到以下内容
System.TypeLoadException: Could not load type 'Microsoft.Data.Entity.Scaffolding.SqliteDesignTimeServices, EntityFramework.Sqlite.Design'.
  at Microsoft.Data.Entity.Design.Internal.DesignTimeServicesBuilder.ConfigureProviderServices (System.String provider, IServiceCollection services, Boolean throwOnError) [0x00000] in <filename unknown>:0 
  at Microsoft.Data.Entity.Design.Internal.DesignTimeServicesBuilder.Build (Microsoft.Data.Entity.DbContext context) [0x00000] in <filename unknown>:0 
  at Microsoft.Data.Entity.Design.MigrationsOperations.AddMigration (System.String name, System.String outputDir, System.String contextType) [0x00000] in <filename unknown>:0 
  at Microsoft.Data.Entity.Commands.Program+Executor+<>c__DisplayClass6_0.<AddMigration>b__0 () [0x00000] in <filename unknown>:0 
  at Microsoft.Data.Entity.Commands.Program+Executor.Execute (System.Action action) [0x00000] in <filename unknown>:0 
Could not load type 'Microsoft.Data.Entity.Scaffolding.SqliteDesignTimeServices, EntityFramework.Sqlite.Design'.

我的project.json文件包含以下其他文件

"dependencies": {
  "EntityFramework.Commands": "7.0.0-rc1-final",
  "EntityFramework.SQLite": "7.0.0-rc1-final"
},
"commands": {
  "ef": "EntityFramework.Commands"
},

我需要做些什么才能解决此错误?

2 个答案:

答案 0 :(得分:6)

由于区分大小写的文件系统,软件包名称在Linux和OS X上区分大小写。请务必在 project.json 文件中使用EntityFramework.Sqlite而不是EntityFramework.SQLite。 (参见GitHub问题dotnet/cli#236

答案 1 :(得分:0)

首先解析您的引用/依赖项。必须解决所有参考警告,并且必须为“7.0.0-rc1-final”。

如果没有“7.0.0-rc1-final”版本,则可能会将某些内容重命名为其他名称。请参阅annoncement repro了解更改

"dependencies": {
  "EntityFramework.Commands": "7.0.0-rc1-final",
  "EntityFramework.SQLite": "7.0.0-rc1-final"
},