entity-framework - 启用迁移 : The term 'Enable-Migrations' is not recognized as the name of a cmdlet

标签 entity-framework asp.net-web-api

我正在尝试在我的解决方案之一上安装 EntityFramefork,但 Package Manager Console无法识别 Enable-Migrations .

PM> Enable-Migrations
Enable-Migrations : The term 'Enable-Migrations' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a pa
th was included, verify that the path is correct and try again.
At line:1 char:1
+ Enable-Migrations
+ ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Enable-Migrations:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

enter image description here
project.json
{
  "version": "1.0.0-*",
  "compilationOptions": {
    "emitEntryPoint": true
  },

  "dependencies": {
    "EntityFramework": "6.1.3",
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
    "Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
    "Microsoft.AspNet.Mvc.WebApiCompatShim": "6.0.0-rc1-final",
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
    "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration.FileProviderExtensions": "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final",
    "Newtonsoft.Json": "10.0.2"
  },

  "commands": {
    "web": "Microsoft.AspNet.Server.Kestrel"
  },

  "frameworks": {
    "dnx451": {
      "dependencies": {
        "Application": "1.0.0-*",
        "Microsoft.AspNet.WebApi.Client": "5.2.3",
        "Models": "1.0.0-*",
        "Newtonsoft.JsonResult": "1.0.5778.10762"
      }
    }
  },

  "exclude": [
    "wwwroot",
    "node_modules"
  ],
  "publishExclude": [
    "**.user",
    "**.vspscc"
  ]
}

我也从不同的线程中遵循了这些步骤,但没有成功:
1. 使用 -IncludePrerelease 重新安装 EF
2.以管理员权限重启VS

Package Manager Console Enable-Migrations CommandNotFoundException only in a specific VS project

最佳答案

EF Core 不再具有 Enable-Migrations 命令。 “默认”启用迁移。使用 Add-Migration 添加新迁移。

关于包管理器命令的文档是 here

关于entity-framework - 启用迁移 : The term 'Enable-Migrations' is not recognized as the name of a cmdlet,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44057203/

相关文章:

entity-framework - Entity Framework : mix table per type and table per hierarchy

c# - ASP.NET Web Api 在选择操作时忽略 RouteParameter.Optional

asp.net-web-api - 如何更改.Net Core中 Controller 的OnActionExecuted方法中API的响应

C# Entity Framework 在 ExecuteFunction 上抛出错误

java - 使用 gson 将日期从 c# webapi 交换到 java

javascript - 使用 .net 发布大文件后出现 404

jquery - 如何强制从 ASP.NET WebAPI 下载文件

c# - 如何对随时间变化的表格数据进行建模并能够回溯到任何点

c# - Entity Framework 中的分组和计数

c# - 我需要在 LINQ 查询后强制 Dispose 吗?