c# - 将目标框架从 .NetStandard 2.0 更改为 .net 4.7.2 后无法进行 nuget 恢复

标签 c# nuget .net-standard nuget-package-restore .net-framework-version

我刚刚将我们的几个项目从 .net framework 4.6.2 更新到 .net framework 4.7.2,但出现以下错误:

Package Microsoft.AspNetCore 2.1.2 is not compatible with net472 (.NETFramework,Version=v4.7.2). Package Microsoft.AspNetCore 2.1.2 supports: netstandard2.0 (.NETStandard,Version=v2.0)
    Package Microsoft.AspNetCore.Authentication.Cookies 2.1.1 is not compatible with net472 (.NETFramework,Version=v4.7.2). Package Microsoft.AspNetCore.Authentication.Cookies 2.1.1 supports: netstandard2.0 (.NETStandard,Version=v2.0)
    Package Microsoft.AspNetCore.Authentication.JwtBearer 2.1.1 is not compatible with net472 (.NETFramework,Version=v4.7.2). Package Microsoft.AspNetCore.Authentication.JwtBearer 2.1.1 supports: netstandard2.0 (.NETStandard,Version=v2.0)
    Package Microsoft.AspNetCore.Cors 2.1.1 is not compatible with net472 (.NETFramework,Version=v4.7.2). Package Microsoft.AspNetCore.Cors 2.1.1 supports: netstandard2.0 (.NETStandard,Version=v2.0)
    Package Microsoft.AspNetCore.Identity.EntityFrameworkCore 2.1.2 is not compatible with net472 (.NETFramework,Version=v4.7.2). Package Microsoft.AspNetCore.Identity.EntityFrameworkCore 2.1.2 supports: netstandard2.0 (.NETStandard,Version=v2.0)
    Package Microsoft.AspNetCore.Mvc 2.1.1 is not compatible with net472 (.NETFramework,Version=v4.7.2). Package Microsoft.AspNetCore.Mvc 2.1.1 supports: netstandard2.0 (.NETStandard,Version=v2.0)
    Package Microsoft.AspNetCore.StaticFiles 2.1.1 is not compatible with net472 (.NETFramework,Version=v4.7.2). Package Microsoft.AspNetCore.StaticFiles 2.1.1 supports: netstandard2.0 (.NETStandard,Version=v2.0)
    Package Microsoft.EntityFrameworkCore.SqlServer 2.1.1 is not compatible with net472 (.NETFramework,Version=v4.7.2). Package Microsoft.EntityFrameworkCore.SqlServer 2.1.1 supports: netstandard2.0 (.NETStandard,Version=v2.0)
    Package Microsoft.EntityFrameworkCore.Tools 2.1.1 is not compatible with net472 (.NETFramework,Version=v4.7.2). Package Microsoft.EntityFrameworkCore.Tools 2.1.1 supports: netstandard2.0 (.NETStandard,Version=v2.0)
    Package Microsoft.Extensions.Configuration.UserSecrets 2.1.1 is not compatible with net472 (.NETFramework,Version=v4.7.2). Package Microsoft.Extensions.Configuration.UserSecrets 2.1.1 supports: netstandard2.0 (.NETStandard,Version=v2.0)
    Package Microsoft.Extensions.Logging.Debug 2.1.1 is not compatible with net472 (.NETFramework,Version=v4.7.2). Package Microsoft.Extensions.Logging.Debug 2.1.1 supports: netstandard2.0 (.NETStandard,Version=v2.0)
    Package Microsoft.VisualStudio.Web.BrowserLink 2.1.1 is not compatible with net472 (.NETFramework,Version=v4.7.2). Package Microsoft.VisualStudio.Web.BrowserLink 2.1.1 supports: netstandard2.0 (.NETStandard,Version=v2.0)
    Package Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore 2.1.1 is not compatible with net472 (.NETFramework,Version=v4.7.2). Package Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore 2.1.1 supports: netstandard2.0 (.NETStandard,Version=v2.0)
    Package Microsoft.EntityFrameworkCore.Relational 2.1.1 is not compatible with net472 (.NETFramework,Version=v4.7.2). Package Microsoft.EntityFrameworkCore.Relational 2.1.1 supports: netstandard2.0 (.NETStandard,Version=v2.0)
    Package Microsoft.VisualStudio.Web.CodeGenerators.Mvc 2.1.1 is not compatible with net472 (.NETFramework,Version=v4.7.2). Package Microsoft.VisualStudio.Web.CodeGenerators.Mvc 2.1.1 supports: netstandard2.0 (.NETStandard,Version=v2.0)
    One or more packages are incompatible with .NETFramework,Version=v4.7.2.
    Package Microsoft.AspNetCore 2.1.2 is not compatible with net472 (.NETFramework,Version=v4.7.2) / win7-x86. Package Microsoft.AspNetCore 2.1.2 supports: netstandard2.0 (.NETStandard,Version=v2.0)
    Package Microsoft.AspNetCore.Authentication.Cookies 2.1.1 is not compatible with net472 (.NETFramework,Version=v4.7.2) / win7-x86. Package Microsoft.AspNetCore.Authentication.Cookies 2.1.1 supports: netstandard2.0 (.NETStandard,Version=v2.0)
    Package Microsoft.AspNetCore.Authentication.JwtBearer 2.1.1 is not compatible with net472 (.NETFramework,Version=v4.7.2) / win7-x86. Package Microsoft.AspNetCore.Authentication.JwtBearer 2.1.1 supports: netstandard2.0 (.NETStandard,Version=v2.0)
    Package Microsoft.AspNetCore.Cors 2.1.1 is not compatible with net472 (.NETFramework,Version=v4.7.2) / win7-x86. Package Microsoft.AspNetCore.Cors 2.1.1 supports: netstandard2.0 (.NETStandard,Version=v2.0)
    Package Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore 2.1.1 is not compatible with net472 (.NETFramework,Version=v4.7.2) / win7-x86. Package Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore 2.1.1 supports: netstandard2.0 (.NETStandard,Version=v2.0)
    Package Microsoft.AspNetCore.Identity.EntityFrameworkCore 2.1.2 is not compatible with net472 (.NETFramework,Version=v4.7.2) / win7-x86. Package Microsoft.AspNetCore.Identity.EntityFrameworkCore 2.1.2 supports: netstandard2.0 (.NETStandard,Version=v2.0)
    Package Microsoft.AspNetCore.Mvc 2.1.1 is not compatible with net472 (.NETFramework,Version=v4.7.2) / win7-x86. Package Microsoft.AspNetCore.Mvc 2.1.1 supports: netstandard2.0 (.NETStandard,Version=v2.0)
    Package Microsoft.AspNetCore.StaticFiles 2.1.1 is not compatible with net472 (.NETFramework,Version=v4.7.2) / win7-x86. Package Microsoft.AspNetCore.StaticFiles 2.1.1 supports: netstandard2.0 (.NETStandard,Version=v2.0)
    Package Microsoft.EntityFrameworkCore.SqlServer 2.1.1 is not compatible with net472 (.NETFramework,Version=v4.7.2) / win7-x86. Package Microsoft.EntityFrameworkCore.SqlServer 2.1.1 supports: netstandard2.0 (.NETStandard,Version=v2.0)
    Package Microsoft.EntityFrameworkCore.Tools 2.1.1 is not compatible with net472 (.NETFramework,Version=v4.7.2) / win7-x86. Package Microsoft.EntityFrameworkCore.Tools 2.1.1 supports: netstandard2.0 (.NETStandard,Version=v2.0)
    Package Microsoft.Extensions.Configuration.UserSecrets 2.1.1 is not compatible with net472 (.NETFramework,Version=v4.7.2) / win7-x86. Package Microsoft.Extensions.Configuration.UserSecrets 2.1.1 supports: netstandard2.0 (.NETStandard,Version=v2.0)
    Package Microsoft.Extensions.Logging.Debug 2.1.1 is not compatible with net472 (.NETFramework,Version=v4.7.2) / win7-x86. Package Microsoft.Extensions.Logging.Debug 2.1.1 supports: netstandard2.0 (.NETStandard,Version=v2.0)
    Package Microsoft.VisualStudio.Web.BrowserLink 2.1.1 is not compatible with net472 (.NETFramework,Version=v4.7.2) / win7-x86. Package Microsoft.VisualStudio.Web.BrowserLink 2.1.1 supports: netstandard2.0 (.NETStandard,Version=v2.0)
    Package Microsoft.EntityFrameworkCore.Relational 2.1.1 is not compatible with net472 (.NETFramework,Version=v4.7.2) / win7-x86. Package Microsoft.EntityFrameworkCore.Relational 2.1.1 supports: netstandard2.0 (.NETStandard,Version=v2.0)
    Package Microsoft.VisualStudio.Web.CodeGenerators.Mvc 2.1.1 is not compatible with net472 (.NETFramework,Version=v4.7.2) / win7-x86. Package Microsoft.VisualStudio.Web.CodeGenerators.Mvc 2.1.1 supports: netstandard2.0 (.NETStandard,Version=v2.0)
    One or more packages are incompatible with .NETFramework,Version=v4.7.2 (win7-x86).

真正让我感到困惑的是 .NETFramework 4.7.2 与 .NET Standard 2.0 兼容,那么为什么我们会收到此错误消息?这没有意义! 非常感谢任何帮助。

最佳答案

我在我们的 CI 服务器上遇到了这个问题,原来安装了 nuget.exe 的旧副本,将其升级到最新版本修复了这个问题(v4.1 到 4.7)

关于c# - 将目标框架从 .NetStandard 2.0 更改为 .net 4.7.2 后无法进行 nuget 恢复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51483168/

相关文章:

c# - Protobuf-net 枚举序列化行为在版本中发生了变化。 2.3.0

c# - 基于 .Net 中的字段反序列化 json (C#)

Nuget包始终使用Release文件夹

asp.net - .NET Standard 版本控制规则是什么?

C# 从数据库中的表填充组合框

c# - 转换为货币

c# - 库引用与 NuGet 包

visual-studio - nuget.org 和 api.nuget.org 之间有什么区别

c# - 从完整引用 .net 标准库是否需要运送系统。* 程序集

.net-standard - 如何将 .NET Standard 代码标记为符合 CLS?