DougMurphy.TargetFrameworks.EndOfLife
2.1.1
Prefix Reserved
See the version list below for details.
dotnet add package DougMurphy.TargetFrameworks.EndOfLife --version 2.1.1
NuGet\Install-Package DougMurphy.TargetFrameworks.EndOfLife -Version 2.1.1
<PackageReference Include="DougMurphy.TargetFrameworks.EndOfLife" Version="2.1.1" />
paket add DougMurphy.TargetFrameworks.EndOfLife --version 2.1.1
#r "nuget: DougMurphy.TargetFrameworks.EndOfLife, 2.1.1"
// Install DougMurphy.TargetFrameworks.EndOfLife as a Cake Addin #addin nuget:?package=DougMurphy.TargetFrameworks.EndOfLife&version=2.1.1 // Install DougMurphy.TargetFrameworks.EndOfLife as a Cake Tool #tool nuget:?package=DougMurphy.TargetFrameworks.EndOfLife&version=2.1.1
Introduction
Knowing if your Target Framework Moniker (TFM) is End of Life (EOL) or not can be very important in certain circumstances. Maybe your company requires using supported target frameworks for compliance reasons, maybe you're publishing a NuGet package and want to make sure you're only supporting frameworks that Microsoft supports, or maybe you just want to make sure you're staying up-to-date. No matter the reason, this NuGet package can help you out with that.
Methods
GetAllEndOfLifeTargetFrameworkMonikers
By default, this method will get all TFMs that are currently EOL. Two overloads are provided where you can either pass in an explicit DateTime
to get all TFMs that will be EOL by that date, or a TimeframeUnit
with an amount to forecast out to a date relative to current date.
CheckTargetFrameworkForEndOfLife
This method takes in a singular TFM or semicolon-delimited pluralized TFM and returns back which one(s), if any, of them are currently EOL.
Example Usage
Checking if a specific TFM is EOL
using DougMurphy.TargetFrameworks.EndOfLife.Enums;
using DougMurphy.TargetFrameworks.EndOfLife.Helpers;
using DougMurphy.TargetFrameworks.EndOfLife.Models;
using System;
using System.Collections.Generic;
public void CheckIfSingleTfmIsEol() {
var tfm = "net5.0";
TargetFrameworkCheckResponse endOfLifeResults = TargetFrameworkEndOfLifeHelper.CheckTargetFrameworkForEndOfLife(tfm);
if (endOfLifeResults.EndOfLifeTargetFrameworks.Count == 0) {
//the specified TFM is not EOL
}
else {
//the specified TFM is EOL
foreach (KeyValuePair<string, DateTime> endOfLifeTargetFramework in endOfLifeResults.EndOfLifeTargetFrameworks) {
Console.WriteLine($"{endOfLifeTargetFramework.Key} has an EOL date of {endOfLifeTargetFramework.Value}");
}
}
}
public void CheckIfAnyOfMultipleTfmIsEol() {
var tfm = "net5.0;net45";
TargetFrameworkCheckResponse endOfLifeResults = TargetFrameworkEndOfLifeHelper.CheckTargetFrameworkForEndOfLife(tfm);
if (endOfLifeResults.EndOfLifeTargetFrameworks.Count == 0) {
//none of the specified TFMs are EOL
}
else {
//at least one of the specified TFMs are EOL
foreach (KeyValuePair<string, DateTime> endOfLifeTargetFramework in endOfLifeResults.EndOfLifeTargetFrameworks) {
Console.WriteLine($"{endOfLifeTargetFramework.Key} has an EOL date of {endOfLifeTargetFramework.Value}");
}
}
}
public void CheckIfSingleTfmIsEolWithinThreeMonths() {
var tfm = "net5.0";
TargetFrameworkCheckResponse endOfLifeResults = TargetFrameworkEndOfLifeHelper.CheckTargetFrameworkForEndOfLife(tfm, TimeframeUnit.Month, 3);
if (endOfLifeResults.EndOfLifeTargetFrameworks.Count == 0) {
//the specified TFM is not EOL
}
else {
//the specified TFM is EOL
foreach (KeyValuePair<string, DateTime> endOfLifeTargetFramework in endOfLifeResults.EndOfLifeTargetFrameworks) {
Console.WriteLine($"{endOfLifeTargetFramework.Key} has an EOL date of {endOfLifeTargetFramework.Value}");
}
}
}
public void CheckIfAnyOfMultipleTfmIsEolWithinThreeMonths() {
var tfm = "net5.0;net45";
TargetFrameworkCheckResponse endOfLifeResults = TargetFrameworkEndOfLifeHelper.CheckTargetFrameworkForEndOfLife(tfm, TimeframeUnit.Month, 3);
if (endOfLifeResults.EndOfLifeTargetFrameworks.Count == 0) {
//none of the specified TFMs are EOL
}
else {
//at least one of the specified TFMs are EOL
foreach (KeyValuePair<string, DateTime> endOfLifeTargetFramework in endOfLifeResults.EndOfLifeTargetFrameworks) {
Console.WriteLine($"{endOfLifeTargetFramework.Key} has an EOL date of {endOfLifeTargetFramework.Value}");
}
}
}
Getting a list of TFMs that are currently EOL, or will be within a specified forecasted timeframe
using DougMurphy.TargetFrameworks.EndOfLife.Enums;
using DougMurphy.TargetFrameworks.EndOfLife.Helpers;
using DougMurphy.TargetFrameworks.EndOfLife.Models;
using System;
using System.Collections.Generic;
public void GetAllTfmsThatAreEol() {
TargetFrameworkCheckResponse endOfLifeResults = TargetFrameworkEndOfLifeHelper.GetAllEndOfLifeTargetFrameworkMonikers();
foreach (KeyValuePair<string, DateTime> endOfLifeTargetFramework in endOfLifeResults.EndOfLifeTargetFrameworks) {
Console.WriteLine($"{endOfLifeTargetFramework.Key} has an EOL date of {endOfLifeTargetFramework.Value}");
}
}
public void GetAllTfmsThatAreEolWithinOneYear() {
//Get all EOL TFMs that are currently EOL, or will be EOL within 1 year of current date.
TargetFrameworkCheckResponse endOfLifeResults = TargetFrameworkEndOfLifeHelper.GetAllEndOfLifeTargetFrameworkMonikers(TimeframeUnit.Year, 1);
foreach (KeyValuePair<string, DateTime> endOfLifeTargetFramework in endOfLifeResults.EndOfLifeTargetFrameworks) {
Console.WriteLine($"{endOfLifeTargetFramework.Key} has an EOL date of {endOfLifeTargetFramework.Value}");
}
}
Web API Host
If you don't have something set up to automatically update your NuGet packages, and you don't want to worry about updating this one as new TFMs and EOL dates are added, check out my API on GitHub for hassle-free updates!
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Newtonsoft.Json (>= 13.0.1)
-
net5.0
- No dependencies.
-
net6.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Fix EOL dates for .NET Core 3.1, .NET 5, and .NET 6.