c# - 如何更新到 .NETStandard 2.0 NuGet 包

标签 c# .net .net-core .net-standard .net-standard-2.0

我在 Visual Studio 2015 中有一个很好的 .NET Framework 4.7 类库 目前正在使用 Microsoft.Extensions.Configuration NuGet package version 1.1.2 .我正在尝试将其更新为 version 2.0 ,但我收到此错误:

Microsoft.Extensions.Configuration 2.0.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.7', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

我看到新版本只支持.NETStandard 2.0。我是否必须在 Visual Studio 2017 中将我的所有项目转换为 .NET Core.NET Standard

最佳答案

.NET Framework 4.6.1 及更高版本支持 .NET Standard 2.0+,但仅在使用新工具时支持。确保更新到 VS 2017 版本 15.3.0 或更高版本,并安装了 .NET Core SDK 2.0.0,并且解决方案的目录层次结构中没有 global.json 固定较低的 SDK 版本。

您可能还需要在 VS 2017 中安装 .NET Core 工作负载

关于c# - 如何更新到 .NETStandard 2.0 NuGet 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45993891/

相关文章:

c# 使用泛型函数将参数传递给具有许多重载的函数

c# - 使用 vscode : some sort of issue with the project file 运行测试时出错

C# 从任意位置打开配置文件

c# - 为 gRPC 客户端创建接口(interface)以进行单元测试

c# - 如何在运行时查找具有已知属性的MSBuild的哪个运行版本-.NET Core或.NET Framework

c# - 大对象堆友好的 IDictionary

c# - 无法在类库应用程序中找到 security.dll 库

.net - Toast 通知不适用于 Windows 秋季创作者更新

c# - 如何中止来自 .NET 的 HTTP 请求?

c# - Microsoft.Extensions.Configuration 究竟是如何依赖 ASP.NET Core 的?