【问题标题】:Running EF migrations from Package Manager Console gives an error从包管理器控制台运行 EF 迁移会出错
【发布时间】:2016-02-22 10:53:56
【问题描述】:

我正在尝试在 ASP.NET 5 / EF 7 项目上创建迁移。在 project.json 我有:

"dependencies": {
  "EntityFramework.Commands": "7.0.0-rc1-final"
  // Other dependencies
},

"commands": {
  "web": "Microsoft.AspNet.Server.Kestrel --server.urls=http://localhost:5000",
  "ef": "EntityFramework.Commands"
}

我在项目文件夹内的开发人员命令提示符上运行“dnx ef migrations add 'Start'”,迁移创建没有问题...

当我在包管理控制台上运行“ef migrations add 'Start'”时,我得到:

"ef : The term 'ef' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again."

我不知道为什么会出现此错误... project.json 似乎很好...

我在这里错过了一些步骤吗?

【问题讨论】:

    标签: entity-framework visual-studio-2015 asp.net-core asp.net-core-mvc entity-framework-core


    【解决方案1】:

    实体框架目前不在包管理器控制台中提供此功能。更多信息可以在这里找到:https://github.com/aspnet/EntityFramework/issues/978

    【讨论】:

    • 是的,这就是我正在做的和我写的。问题是为什么我在包管理器控制台上运行 EF 命令时会出错。
    • 不再添加 EF 命令(与以前版本的 EF 不同)。您也许可以从包管理器控制台运行 dnx ef。
    猜你喜欢
    • 1970-01-01
    • 2018-09-25
    • 1970-01-01
    • 2013-06-01
    • 2017-12-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多