I believe you should be able to make your library target .NET Standard and you should be able to reference it in a .NET & .NET Framework project.
For example if I had a .NET 5 project & a .NET Framework 4.7.2 project then I'd need to choose a version of .NET Standard that supports a maximum of both of those frameworks & versions. In that case it'd be netstandard2.0
. You can see a table of these minimum versions that each .NET Standard version supports here:
https://learn.microsoft.com/en-us/dotnet/standard/net-standard
Here's a good resource for background reading on .NET Standard & .NET:
https://learn.microsoft.com/en-us/dotnet/standard/library-guidance/cross-platform-targeting
There's also a section of multi-targeting in case your library needs to access APIs that may differ between .NET 5 & .NET Framework. In which case you can configure your library to target both, then in your code you can use compiler directives to make sure that the correct API is called for the current target & that will build your project for each target.