【问题标题】:Which .Net standard version should i use in a library if i have to target both Dot Net Core 3.0 and .Net Framework 4.7.2如果我必须同时针对 Dot Net Core 3.0 和 .Net Framework 4.7.2,我应该在库中使用哪个 .Net 标准版本
【发布时间】:2020-01-29 22:38:01
【问题描述】:

我必须将几个现有的 Dot Net core 2.2 项目迁移到 Dot Net core 3.1。 有一个基于 .Net Framework 4.7.2 的项目。

所以我们有一个基于 .Net Standard 2.0 开发的通用库,因此它可以同时针对 dotnet 2.2 和 .Net framework 4.7.2。

现在如果我必须将我的 Dotnet core 2.2 迁移到 Dotnet core 3.1 并且仍然继续使用公共库,我将不得不将公共库迁移到 .Net Standard 2.1(为了支持 Dot net core 3.x)但这种向 .Net Standard 2.1 的迁移将不允许 .net 框架项目使用公共库。

有什么办法可以处理目前的情况吗?

【问题讨论】:

  • 为什么要使用 2.1 并不明显,它几乎没有有用的补充。引用:“需要支持 .NET Framework 客户的库作者应该继续使用 .NET Standard 2.0”。 devblogs.microsoft.com/dotnet/announcing-net-standard-2-1
  • @HansPassant 使用2.1的问题是它只支持dotnet core 3.x,不支持.net framework。

标签: .net .net-core .net-standard .net-framework-version .net-core-3.1


【解决方案1】:

您无需将 .NET Standard 库从 2.0 更新到 2.1。您仍然可以在 .NET Core 3.1 项目中使用它们。如果您切换到 .NET Standard 2.1,它会以另一种方式工作,那么使用此库的项目版本必须是最低 .NET Core 3.0。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-02-23
    • 1970-01-01
    • 1970-01-01
    • 2019-06-20
    • 2020-01-23
    • 2023-03-13
    • 1970-01-01
    相关资源
    最近更新 更多