我刚刚将我们的几个项目从 .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/