包Microsoft.CSharp 4.5.0与netcoreapp2.1不兼容错误消息



我正在尝试运行ASP.NET Core 2.0应用程序。然而,当我点击在IDE中运行(以构建应用程序(时,我会收到以下错误:

Controller.csproj:[NU1202]程序包Microsoft.CSharp 4.5.0不是兼容netcoreapp2.1(.NETCoreApp,版本=v2.1(。软件包Microsoft.CSharp 4.5.0不支持任何目标框架。

Controller.csproj:[NU1202]包System.Security.Principal 4.3.0是与netcoreapp2.1(.NETCoreApp,版本=v2.1(不兼容。包System.Security.Principal 4.3.0不支持任何目标框架。

谢谢。

您似乎拥有Visual Studio的旧版本。若要创建net core 2.1应用程序,您至少需要Visual Studio 2017 15.7版本,或者如果无法访问此版本,请切换到免费的Visual Studio代码。

是否可以删除对Package System.Security.Principal 4.3.0的引用,并在包管理器中执行以下操作:Install-Package System.Security.Principal.Windows -Version 4.6.0-preview.18571.3

Package System.Security.Principal 4.3.0需要.NET Framework 4.5,并且如错误所示与.NET Core不兼容。

我通过创建一个新的解决方案并指向正确的变量(框架和其他变量(来解决这个问题。非常感谢您的贡献。

最新更新