程序包管理器控制台工具不支持 .Net Core 项目

Package Manager Console Tools doesn't support .Net Core Project

我正在学习教程link

用于学习 .Net Core。我已经正确安装的一切。 但是当我 运行 迁移时它给出了错误。

Project.json 代码为:

{
  "dependencies": {
    "Microsoft.NETCore.App": {
      "version": "1.0.0",
      "type": "platform"
    },
    "Microsoft.AspNetCore.Diagnostics": "1.0.0",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
    "Microsoft.Extensions.Logging.Console": "1.0.0",
    "Microsoft.EntityFrameworkCore.SqlServer": "1.1.2",
    "Microsoft.EntityFrameworkCore.Tools": "2.0.0-preview1-final",
    "Microsoft.AspNetCore.Mvc": "1.0.0"
  },

  "tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
  },

  "frameworks": {
    "netcoreapp1.0": {
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ]
    }
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "runtimeOptions": {
    "configProperties": {
      "System.GC.Server": true
    }
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "web.config"
    ]
  },

  "scripts": {
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}

请让我知道我哪里错了提前感谢您的帮助。

  1. 不要混淆版本。不要将 EF Core 工具 2.0.0 与 EF Core 1.1
  2. 一起使用
  3. 使用 Microsoft.EntityFrameworkCore.Tools 1.0.0-preview2-final,iirc 它是 LAST 版本,支持 project.json 结构,因此支持 Visual 2015

如果想继续开发ASP.NET核心应用,最好升级到Visual Studio2017和csproj,因为project.json类型的项目不会supported/updated 了。 dotnet/PowerShell 工具的所有新版本将仅支持带有 csproj 的 VS2017。

另外

从 csproj (Version 1.0.0-preview3-final) 开始如果你想要 dotnet ef 支持,你还需要为 dotnet ef 命令安装 Microsoft.EntityFrameworkCore.Tools.DotNet。否则只有 powershell 命令可用。