Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
asp.net core 1.1中无法识别dotnet ef命令_Asp.net_Entity Framework_Asp.net Core_Entity Framework Migrations - Fatal编程技术网

asp.net core 1.1中无法识别dotnet ef命令

asp.net core 1.1中无法识别dotnet ef命令,asp.net,entity-framework,asp.net-core,entity-framework-migrations,Asp.net,Entity Framework,Asp.net Core,Entity Framework Migrations,这是我的项目的project.json。我已将依赖项更新为1.1 { "dependencies": { "BundlerMinifier.Core": "2.4.337", "Microsoft.AspNetCore.Authentication.Cookies": "1.1.1", "Microsoft.AspNetCore.Diagnostics": "1.1.1", "Microsoft.AspNetCore.Diagnostics.EntityFra

这是我的项目的project.json。我已将依赖项更新为1.1

{
  "dependencies": {
    "BundlerMinifier.Core": "2.4.337",
    "Microsoft.AspNetCore.Authentication.Cookies": "1.1.1",
    "Microsoft.AspNetCore.Diagnostics": "1.1.1",
    "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.1.1",
    "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.1.1",
    "Microsoft.AspNetCore.Mvc": "1.1.2",
    "Microsoft.AspNetCore.Razor.Tools": {
      "version": "1.1.0-preview4-final",
      "type": "build"
    },
    "Microsoft.AspNetCore.Routing": "1.1.1",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.1.1",
    "Microsoft.AspNetCore.Server.Kestrel": "1.1.1",
    "Microsoft.AspNetCore.StaticFiles": "1.1.1",
    "Microsoft.EntityFrameworkCore.SqlServer": "1.1.1",
    "Microsoft.EntityFrameworkCore.SqlServer.Design": {
      "version": "1.1.1",
      "type": "build"
    },
    "Microsoft.EntityFrameworkCore.Tools": {
      "version": "1.1.0",
      "type": "build"
    },
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.1",
    "Microsoft.Extensions.Configuration.Json": "1.1.1",
    "Microsoft.Extensions.Configuration.UserSecrets": "1.1.1",
    "Microsoft.Extensions.Logging": "1.1.1",
    "Microsoft.Extensions.Logging.Console": "1.1.1",
    "Microsoft.Extensions.Logging.Debug": "1.1.1",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.1",
    "Microsoft.NETCore.App": {
      "version": "1.1.1",
      "type": "platform"
    },
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.1.0",
    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
      "version": "1.1.0-preview4-final",
      "type": "build"
    },
    "Microsoft.VisualStudio.Web.CodeGenerators.Mvc": {
      "version": "1.1.0",
      "type": "build"
    }
  },

  "tools": {
    "BundlerMinifier.Core": "2.4.337",
    "Microsoft.AspNetCore.Razor.Tools": "1.1.0-preview4-final",
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.1.0-preview4-final",
    "Microsoft.EntityFrameworkCore.Tools": "1.1.0",
    "Microsoft.EntityFrameworkCore.Tools.DotNet": "1.0.0",
    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
      "version": "1.1.0-preview4-final",
      "imports": [
        "portable-net45+win8"
      ]
    }
  },

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

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

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

  "publishOptions": {
    "include": [
      "wwwroot",
      "**/*.cshtml",
      "appsettings.json",
      "web.config"
    ]
  },

  "scripts": {
    "prepublish": [ "bower install", "dotnet bundle" ],
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}
迁移以前运行得很好。我在SQL Server中创建了迁移和数据库。现在,当我尝试创建迁移时,我遇到了这个错误

dotnet-ef : The term 'dotnet-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.
At line:1 char:1
+ dotnet-ef
+ ~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (dotnet-ef:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

我在互联网上尝试了一些解决方案,但仍然出现了错误。我是否缺少任何软件包?

通过Powershell而不是软件包管理器控制台运行
dotnet ef
。或者,在Package Manager控制台中将当前目录更改为项目目录(使用
cd

此外,请确保已安装Entity Framework Tools包


您在哪里运行了
dotnet ef
脚本?在VS 2015Package manager控制台中的哪个环境和什么路径?@S.Serp当我在解决方案中将目录更改为项目目录时,dotnet ef命令起作用。但当我添加一些命令时,比如dotnet ef migrations add,它表示找不到任何项目。更改当前工作目录或使用--project选项。编辑:从项目目录执行时,命令提示符中会显示相同的无项目输出。我在Visual Studio中的何处可以找到powershell?