To convert a .NET Standard 2.0 C# library to .NET 7, you need to change the <TargetFramework> to be like this: <TargetFramework>net7.0</TargetFramework>¹. You also need to update all Nuget packages in the project to match the .NET Core 7 version².
If you need to support an earlier version, it is recommend to target .NET Standard 2.0. Most general-purpose libraries should not need APIs outside of .NET Standard 2.0. .NET Standard 2.0 is supported by all modern platforms and is the recommended way to support multiple platforms with one target³.
(1) Migrate from .net standard to .net 6 using the upgrade tool.
(2) Upgrading netstandard 2.0 class library to dotnet 6.
(3) .NET Standard | Microsoft Learn.