实体框架核心软件包管理器控制台工具不支持PowerShell 2.0版。升级到PowerShell 3.0或更高版本

时间:2017-01-13 13:43:19

标签: asp.net-core entity-framework-core

我想在EF Core中使用Asp.net core,所以我按照Instruction进行操作 但是当我想使用这个命令:Add-Migration first在PackageManger控制台中创建数据库时,它给了我这个错误:

  

实体框架核心软件包管理器控制台工具不支持PowerShell 2.0版。升级到PowerShell 3.0或更高版本,重新启动Visual Studio,然后重试。

问题是什么?

注意:这是我的Project.json文件:

{
 "dependencies": {
   "Microsoft.NETCore.App": {
     "version": "1.0.1",
     "type": "platform"
   },
   "Microsoft.AspNetCore.Mvc": "1.0.1",
   "Microsoft.AspNetCore.Routing": "1.0.1",
   "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
   "Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
   "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
   "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
   "Microsoft.Extensions.Configuration.Json": "1.0.0",
   "Microsoft.Extensions.Logging": "1.1.0",
   "Microsoft.Extensions.Logging.Console": "1.0.0",
   "Microsoft.Extensions.Logging.Debug": "1.0.0",
   "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
   "Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
   "Microsoft.EntityFrameworkCore.Tools": "1.1.0-preview4-final",
   "Microsoft.EntityFrameworkCore.Design": "1.1.0"
  },

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

 "frameworks": {
   "netcoreapp1.0": {
    "imports": [
      "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": {
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
   }
}

2 个答案:

答案 0 :(得分:1)

首先从下面的链接下载最新版本的NuGet

https://dist.nuget.org/win-x86-commandline/latest/nuget.exe

然后在exe下下载并安装它。

https://download.microsoft.com/download/E/7/6/E76850B8-DA6E-4FF5-8CCE-A24FC513FD16/Windows6.1-KB2506143-x64.msu

安装后,重新启动计算机并打开Visual Studio。

它将为我工作

谢谢

答案 1 :(得分:0)

您可以下载Windows Management Framework 3.0 link