当前位置 : 主页 > 网络编程 > ASP >

entity-framework – 此版本的Entity Framework核心软件包管理器控制台工具不支持这些

来源:互联网 收集:自由互联 发布时间:2021-06-24
使用此 tutorial将现有项目更新到ASP.NET Core 1.1和Entity Framework Core 1.1之后 我尝试在Package Management Console中执行“Add-Migration MigrationName”但出现错误: Startup project ‘src\ProjectName’ is an ASP.
使用此 tutorial将现有项目更新到ASP.NET Core 1.1和Entity Framework Core 1.1之后
我尝试在Package Management Console中执行“Add-Migration MigrationName”但出现错误:

Startup project ‘src\ProjectName’ is an ASP.NET Core or .NET Core
project for Visual Studio 2015. This version of the Entity Framework
Core Package Manager Console Tools doesn’t support these types of
projects.

我正在使用VS 2015 Update 3.
Project.json

{
  "dependencies": {
    "CoursesManagement.DAL": "1.0.0-*",
    "Microsoft.AspNetCore.Diagnostics": "1.1.1",
    "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.1.1",
    "Microsoft.AspNetCore.Mvc": "1.1.2",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.1.1",
    "Microsoft.AspNetCore.Server.Kestrel": "1.1.1",
    "Microsoft.AspNetCore.StaticFiles": "1.1.1",
    "Microsoft.Extensions.Configuration.FileExtensions": "1.1.1",
    "Microsoft.Extensions.Configuration.Json": "1.1.1",
    "Microsoft.Extensions.Logging.Console": "1.1.1",
    "Microsoft.EntityFrameworkCore.SqlServer": "1.1.1",
    "Microsoft.NETCore.App": "1.1.1",
    "Microsoft.EntityFrameworkCore": "1.1.1",
    "Microsoft.EntityFrameworkCore.Tools": {
      "version": "1.1.0",
      "type": "build"
    },
    "Microsoft.EntityFrameworkCore.Design": "1.1.1"
  },

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

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

  "runtimes": {
    "win10-x64": {}
  },

  "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%" ]
  }
}

global.json

{
  "projects": [ "src" ],
  "sdk": {
    "version": "1.0.0-preview2-003131"
  }
}
如 this博客中所述,

We’re now encouraging everyone to migrate to MSBuild and csproj from project.json. As I stated above, we will not be supporting any of the new .NET Core tools in Visual Studio 2015. We also won’t be updating the Visual Studio 2015 project.json-based tools.

您正在使用不支持project.json的EFCore.Tools包1.1.0版. project.json的工具从未到达RTM.适用于EF Core 1.1软件包的预览版本是EFCore.Tools 1.1.0-preview4-final.

另外如其他答案所述,如果你想使用powershell命令,那么你需要安装EFCore.Tools包,但如果你想要dotnet ef那么你需要安装EFCore.Tools.DotNet(版本1.1.0-preview3-final自preview4 – 最小的问题).

如上所述,基于project.json的工具不会有任何更新.您仍然可以使用上面的预览包,但最好的选择是尽可能迁移到VS2017 csproj.

网友评论