I have a class library which is currently multi-targeting NET40 and NETSTANDARD2.0:
<TargetFrameworks>net40;netstandard2.0</TargetFrameworks>
However, I now need to also support some new api which was added as part of NETCOREAPP2.1 which is not covered by netstandard.
My initial thought is to simply expand the current frameworks to include NETCOREAPP2.1:
<TargetFrameworks>net40;netstandard2.0;netcoreapp2.1</TargetFrameworks>
<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.1'">
<DefineConstants>NETCORE</DefineConstants>
</PropertyGroup>
and in the code I can use the newly added API like so:
#if NETCORE
// Use the api added in NETCORE 2.1
#endif
However what will happen once the library is used in the app targeting later versions of .NET Core? e.g. .NET Core 2.2? Do I have to create new constants for every newly released version?
In an ideal world NETCOREAPP2.1 would implement NETSTANDARD2.1 but unfortunately THIS is not the case.