I have a .NET 6 ASP.NET Core project in VS 2022 and wonder if there is a way not to get .NET 7 packages in my NuGet update list? Or am I supposed to update NutGet packages to 7.0.X? What is the best practice?
Check dependencies for the corresponding packages. For example Microsoft.Extensions.DependencyInjection
7.0.0 specifies next supported frameworks and dependecies:
But for example Microsoft.AspNetCore.Authentication.JwtBearer
7.0.0 is only supported only for .NET 7 (my guess would be that either all or almost all ASP.NET Core packages would behave the same way):
So while in theory you can upgrade some of dependencies but definitely not all without updating target framework version. In general case I prefer to update either everything to the next major version or nothing (for packages supporting the "tied to runtime" versioning).