微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

我正在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,PublicKeyToken=b03f5f7f11d50a3a' which has a higher
version than referenced assembly 'System.Runtime' with identity 'System.Runtime,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”,但它告诉我“System.IO和System.Runtime中都存在类型IOException.”

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

谢谢.

编辑:刚刚尝试了一个新的包装项目,它似乎也失败了,所以有些事情发生了.

解决方法

尝试将其仅添加到.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.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐