ARTICLE AD BOX
Is there a way to check for a C# .NET application to check if the used .NET version is still supported?
My current solution is a hard programmed check of the official date.
/// <summary> /// Check .NET version /// https://dotnet.microsoft.com/en-us/platform/support/policy/dotnet-core /// </summary> protected void GetNetVersion() { DateTime endOfLife; this.NetVersion.Text = System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription ?? Environment.Version.ToString(); //.NET 10 - End of support -> November 14, 2028 if ( Environment.Version.Major.Equals(10) && DateTime.Now > (endOfLife = DateTime.Parse("2028-11-14")) ){ this.NetVersion.Background = new SolidColorBrush(Colors.LightGoldenrodYellow); this.NetVersion.Text = this.NetVersion.Text + "\n" + String.Format(Strings.InfoNetOutOfSupport, endOfLife.ToShortDateString()); } }I am afraid, that this hard programmed point will be missed on changes of the .NET version. Is there any way to check this dynamically?
