使用最新的Entity Framework Core獲取Newtonsoft.Json程序集錯誤

entity-framework entity-framework-core

在為TC 2安裝最新的Visual Studio更新後,我創建了一個新的Web Api項目。

在項目中添加了實體Microsoft.EntityFrameworkCore": "1.0.0-rc2-finalMicrosoft.EntityFrameworkCore.Tools: 1.0.0-preview1-final

打開命令行並鍵入dotnet ef

此時我收到了一個錯誤:

Could not load file or assembly 'Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified. 

我有錯誤的工具版本嗎?

我使用的版本是intellisense提供的版本。

來自project.json的摘錄:

{
  "dependencies": {
    "Microsoft.NETCore.App": {
      "version": "1.0.0-rc2-3002702",
      "type": "platform"
    },
    "Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-rc2-final",
    "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0-rc2-final",
    "Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-final",
    "Microsoft.Extensions.Logging": "1.0.0-rc2-final",
    "Microsoft.Extensions.Logging.Console": "1.0.0-rc2-final",
    "Microsoft.Extensions.Logging.Debug": "1.0.0-rc2-final",
    "Microsoft.EntityFrameworkCore": "1.0.0-rc2-final",
    "Microsoft.EntityFrameworkCore.SqlServer": "1.0.0-rc2-final",
    "Microsoft.NETCore.Platforms": "1.0.1-rc2-24027",
    "Microsoft.EntityFrameworkCore.Tools": {
      "version": "1.0.0-preview1-final" ,
      "type": "build"
    }
  },

  "tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": {
      "version": "1.0.0-preview1-final",
      "imports": "portable-net45+win8+dnxcore50"
    },
    "Microsoft.EntityFrameworkCore.Tools": {
      "imports": [ "portable-net451+win8" ],
      "version": "1.0.0-preview1-final"
    }
  },

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

一般承認的答案

拯救我一天的解決方法。

  1. 刪除:

    • %USERPROFILE%\.nuget\packages\.tools\Microsoft.EntityFrameworkCore.Tools
    • %USERPROFILE%\.nuget\packages\Microsoft.EntityFrameworkCore.Tools
  2. 重新運行dotnet restore


熱門答案

這似乎是RC2中的已知問題。

我會將此標記為已回答,並等待EF團隊對其進行排序。



Related

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