實體框架核心軟件包管理器控制台工具不支持PowerShell 2.0版。升級到PowerShell 3.0或更高版本

asp.net-core entity-framework-core

我想在Asp.net core使用EF Core ,所以我遵循這個指令但是當我想使用這個命令時: Add-Migration first在PackageManger控制台中創建數據庫的Add-Migration first ,它給了我這個錯誤:

實體框架核心軟件包管理器控制台工具不支持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%" ]
   }
}

熱門答案

首先從下面鏈接下載最新版本的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。

它對我有用

謝謝



Related

許可下: CC-BY-SA with attribution
不隸屬於 Stack Overflow
這個KB合法嗎? 是的,了解原因
許可下: CC-BY-SA with attribution
不隸屬於 Stack Overflow
這個KB合法嗎? 是的,了解原因