EF,Add-Migration;无法执行此命令,因为安装的Microsoft.EntityFrameworkCore.Design版本与此工具不兼容

时间:2016-11-03 19:04:32

标签: asp.net-mvc entity-framework asp.net-core migration ef-migrations

最近,当执行Add-Migration命令时,我收到了以下错误

Cannot execute this command because the version of Microsoft.EntityFrameworkCore.Design installed is not compatible with this tool.

我当前的project.json

{
  "buildOptions": {
    "emitEntryPoint": true
  },
  "frameworks": {
    "netcoreapp1.0": {}
  },
  "dependencies": {
    "Microsoft.AspNetCore.Identity": "1.0.0",
    "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0",
    "Microsoft.NETCore.App": "1.0.1",
    "Microsoft.EntityFrameworkCore.SqlServer": "1.0.1",
    "System.Linq.Queryable": "4.0.1",
    "System.Linq.Dynamic.Core": "1.0.6.8",
    "OpenIddict": "1.0.0-*",
    "Microsoft.EntityFrameworkCore.Design": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    }
  },
  "tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview3-final",
    "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview3-final"
  },
  "runtimes": {
    "win10-x64": {}
  }
}

但我也试过版本

 "Microsoft.EntityFrameworkCore.Design": "1.0.1"

dotnet restore和dotnet -ef命令都正在执行,没有任何问题。

谢谢, 康拉德

1 个答案:

答案 0 :(得分:1)

感谢Tseng, 它在改为:

后开始工作
  "tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview3-final",
"Microsoft.EntityFrameworkCore.Tools": {
  "version": "1.0.0-preview2-final",
  "imports": [
    "portable-net45+win8+dnxcore50",
    "portable-net45+win8"
  ]
}

},