c# - System.Runtime.Extensions 需要更高版本的 System.Runtime

标签 c# asp.net .net nuget asp.net-core

我正在 Visual Studio 中处理其中一个新的“类库(NuGet 包)”项目。一切都很顺利,直到前几天它开始引发有关 System.Runtime.Extensions 程序集的错误:

Assembly 'System.Runtime.Extensions' with identity 'System.Runtime.Extensions,
Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' uses 'System.Runtime,
Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher
version than referenced assembly 'System.Runtime' with identity 'System.Runtime,
Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

我检查了on NuGet这似乎确实是真的,System.Runtime.Extensions 要求 System.Runtime 至少为 4.0.20。

我尝试更改 project.json“dependencies” 部分中的以下行:

"System.Runtime": "4.0.10-beta-23019",

“4.0.20-beta-23019”,但随后它告诉我“IOException 类型存在于 System.IOSystem.Runtime。”

我该怎么做才能解决这个问题?

谢谢。


编辑:刚刚在一个全新的包项目上尝试过这个,它似乎也失败了,所以出了点问题。

最佳答案

尝试仅将其添加到 .NET Core 目标框架:

{
    "dependencies": { },

    "frameworks": {
        "dotnet": {
            "dependencies": {
                "Microsoft.CSharp": "4.0.0",
                "System.Collections": "4.0.10",
                "System.Linq": "4.0.0",
                "System.Runtime.Extensions": "4.0.10",
                "System.Threading": "4.0.10"
            }
        }
    }
}

其中 dnxcore50 是一个 .NET Core 目标框架。例如,也可以是 dotnet

关于c# - System.Runtime.Extensions 需要更高版本的 System.Runtime,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32314521/

相关文章:

c# - 为什么 MaxId 函数在 xml 中总是返回 9?

c# - AppSettings快捷方式问题

c# - 任务并行库中的任务如何影响ActivityID?

c# - 在 ASP.NET MVC 4 中接受 JSON

c# - 使用 .net MVC 5 从用户那里获取图像并将其存储为字符串

c# - 为什么选择 SharpDevelop 而不是 Visual Studio 来使用 C# 进行编码?

asp.net - 防止通知电子邮件中的 Gmail 线程对话

c# - 如何将 li 元素从一个列表移动到另一个列表

.net - Login failed for user "xxx"Failed to open the explicitly specified database解决方法

c# - 一种 ;在 C# 中没有声明