实体框架 7 逆向工程不起作用



我在Windows 10上运行Visual Studio 2015。这是我的项目.json和global.json

{
  "version": "1.0.0-*",
  "description": "Application.Data Class Library",
  "authors": [ "------" ],
  "tags": [ "" ],
  "projectUrl": "",
  "licenseUrl": "",
  "frameworks": {
    "dnx451": {
    }
  },
  "dependencies": {
    "EntityFramework.SqlServer": "7.0.0-rc1-15886",
    "EntityFramework.Commands": "7.0.0-rc1-15945",
    "EntityFramework.Core": "7.0.0-rc1-15945",
    "EntityFramework.SqlServer.Design": "7.0.0-rc1-15886"
  },
  "commands": {
    "ef": "EntityFramework.Commands"
  }  
}

{
  "projects": [ "Application.Data", "Application.WebApi" ],
  "sdk": {
    "version": "1.0.0-rc1-16048",
    "runtime": "clr",
    "architecture": "x86"
  }
}

当我运行dnx ef时,我得到这个消息错误

C:Users-------DocumentsVisual Studio 2015ProjectsApplicationApplication.Data>dnx ef --help
System.InvalidOperationException: No service for type 'Microsoft.Dnx.Runtime.IRuntimeEnvironment' has been registered.
   à Microsoft.Extensions.DependencyInjection.ServiceProviderExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
   à Microsoft.Extensions.DependencyInjection.ServiceProviderExtensions.GetRequiredService[T](IServiceProvider provider)
   à Microsoft.Data.Entity.Commands.Program..ctor(IServiceProvider dnxServices)

dnx版本rc1-16048是最新的,但您使用的是旧版本的EF(以及冲突版本)。此外,SqlServer已重命名为MicrosoftSqlServer。截至本文撰写之时,最新版本为:

"EntityFramework.Commands": "7.0.0-rc1-16147",
"EntityFramework.Core": "7.0.0-rc1-16147",
"EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-16147",
"EntityFramework.MicrosoftSqlServer.Design": "7.0.0-rc1-16147"

最新更新