With increasingly rapid evolutions of Framework, it is sometimes desirable to remain, for some projects, with deprecated versions of .Net.
It must be a conscious decision of the risks but you must be able to say “I accepted this risk and I don’t want to be bothered by these warnings anymore”.
One solution is to set precisely the version number of the SDK used for that compilation by using a global.json file. Doing so ensure you also use same deprecated SDK.
But you could prefer to use a more recent SDK while building for an ancient target.
And without warning. That’s exactly what CheckEolTargetFramework
permit us to do: it’s a MSBuild property that can be set to to false to prevent warning NETSDK1138.
More on this subject on Fixing build warning NETSSDK1138 when building projects with end-of-life .NET frameworks.