简体   繁体   中英

Visual Studio Nuget Package Manager Net Core allowing packages that are higher then target sdk

So i have a project targeting Net Core 2.1 (specifically 2.1.500)

I also have a global.json which also has 2.1.500 in it.

Recently Microsoft updated to Net Core 2.2 but I don't want to move to that yet.

When I open Nuget Package Manager it shows me that there are updates available to some pacakges

在此处输入图片说明

the problem is that all of these packages are for 2.2 sdk and it completely ignores the fact that I am not targeting that.

This seems like a bug , because in the .Net Framework it would not suggest packages that were targeting an sdk higher than the one you were using.

Is this correct? should I report an issue to the Net Core team?

The functionality is correct. The libraries target the .NETStandard2.0 not .NET Core App 2.2 which means any .NET Core app that is compatible with the .NET Standard 2.0 can use the libraries, regardless of the .NET SDK they are using.

For an example, take a look at EntityFramework.SqlServerCompact in the Manage Nuget Packages window in Visual Studio. It lists its dependencies as .NETFramework,Version=v4.0 , which means it won't work in .NET Core or any earlier versions of the .NET Framework .

Additionally, if you try to install the EntityFramework.SqlServerCompact package in a .NET Core you will see an error in the Error List window:

Warning NU1701 Package 'EntityFramework.SqlServerCompact 6.2.0' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM