DougMurphy.TargetFrameworks.EndOfLife 3.0.0

Prefix Reserved
dotnet add package DougMurphy.TargetFrameworks.EndOfLife --version 3.0.0                
NuGet\Install-Package DougMurphy.TargetFrameworks.EndOfLife -Version 3.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DougMurphy.TargetFrameworks.EndOfLife" Version="3.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DougMurphy.TargetFrameworks.EndOfLife --version 3.0.0                
#r "nuget: DougMurphy.TargetFrameworks.EndOfLife, 3.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install DougMurphy.TargetFrameworks.EndOfLife as a Cake Addin
#addin nuget:?package=DougMurphy.TargetFrameworks.EndOfLife&version=3.0.0

// Install DougMurphy.TargetFrameworks.EndOfLife as a Cake Tool
#tool nuget:?package=DougMurphy.TargetFrameworks.EndOfLife&version=3.0.0                

Nuget Version Nuget Downloads

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 Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 is compatible.  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.  net9.0 is compatible. 
.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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.0.0 59 11/24/2024
2.2.2 274 9/5/2023
2.2.1 247 5/6/2023
2.2.0 400 11/10/2022
2.1.1 438 8/10/2022
2.1.0 588 2/18/2022
2.0.0 4,650 12/3/2021
1.0.0 4,681 11/24/2021

Add EOL dates for .NET 8 and .NET 9. Remove targeting .NET 6 and .NET 7.