gpt4 book ai didi

entity-framework - 使用最新的 Entity Framework Core 获取 Newtonsoft.Json 程序集错误

转载 作者:行者123 更新时间:2023-12-04 08:35:27 25 4
gpt4 key购买 nike

在为 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

关于entity-framework - 使用最新的 Entity Framework Core 获取 Newtonsoft.Json 程序集错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37364234/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com