【问题标题】:The term 'Enable-Migrations' is not recognized mvc code first术语“启用迁移”首先无法识别 mvc 代码
【发布时间】:2023-03-28 18:36:02
【问题描述】:

我第一次尝试在我的新 mvc 4 应用程序中运行 PM> Enable-Migrations –EnableAutomaticMigrations

我明白了:

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 path was included, verify that the path is correct and try again.
At line:1 char:1
+ Enable-Migrations –EnableAutomaticMigrations

我错过了什么?我已经安装了 e.f 5。

【问题讨论】:

标签: asp.net-mvc-4 ef-code-first


【解决方案1】:

您必须确保项目的路径目录中没有任何方括号“[”。显然 VS 2013 对使用方括号命名的项目文件夹不满意。

【讨论】:

    【解决方案2】:

    首先“Install-Package EntityFramework -IncludePrerelease”然后以管理员身份重新启动 Visual Studio 为我工作。

    [参考这个]:Package Manager Console Enable-Migrations CommandNotFoundException only in a specific VS project

    【讨论】:

      【解决方案3】:

      尝试在包管理器控制台中输入:

      Install-Package EntityFramework -IncludePrerelease
      

      然后重新启动 Visual Studio。

      【讨论】:

      • 重启成功了!
      【解决方案4】:

      我安装了框架 (5.x),并在以管理员模式运行后重试运行相同的命令。这已经解决了这个问题——虽然很奇怪。

      【讨论】:

        猜你喜欢
        • 2016-11-05
        • 1970-01-01
        • 2014-05-28
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-01-27
        相关资源
        最近更新 更多