AlastairLundy.OSCompatibilityLib 3.0.1

Prefix Reserved
dotnet add package AlastairLundy.OSCompatibilityLib --version 3.0.1                
NuGet\Install-Package AlastairLundy.OSCompatibilityLib -Version 3.0.1                
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="AlastairLundy.OSCompatibilityLib" Version="3.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AlastairLundy.OSCompatibilityLib --version 3.0.1                
#r "nuget: AlastairLundy.OSCompatibilityLib, 3.0.1"                
#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 AlastairLundy.OSCompatibilityLib as a Cake Addin
#addin nuget:?package=AlastairLundy.OSCompatibilityLib&version=3.0.1

// Install AlastairLundy.OSCompatibilityLib as a Cake Tool
#tool nuget:?package=AlastairLundy.OSCompatibilityLib&version=3.0.1                

OSCompatibilityLib (formerly RuntimeExtensions)

Features:

OSCompatibilityLib adds .NET Standard 2.0 & 2.1 compatible ways of getting:

  • OS Detection by reimplementing the OperatingSystem class with static methods
  • Re-implementing the RuntimeInformation class to backport Runtime Identifier detection

It also adds some support for programmatically determining the .NET Target Framework Moniker (TFM) being used.

Usage

To get OS Detection support, OSCompatibilityLib needs to replace the reference to the existing OperatingSystem class in a .NET Standard 2.0 project with OSCompatibilityLib's equivalent class.

This can be easily done with a using namespace.

To target only .NET Standard 2.0 use:

#if NETSTANDARD2_0
    using OperatingSystem = AlastairLundy.OSCompatibilityLib.Polyfills.OperatingSystem;
#endif

To target .NET Standard 2.0 and 2.1 use:

#if NETSTANDARD2_0 || NETSTANDARD2_1
    using OperatingSystem = AlastairLundy.OSCompatibilityLib.Polyfills.OperatingSystem;
#endif

Compatibility

The following tables indicate Operating Systems that are capable of being detected with this library.

Desktop Operating Systems

Operating System Target Support Status Required Library Version
Windows ✅, Supported Any
Linux ✅, Supported Any
FreeBSD ✅, Supported Any
macOS ✅, Supported Any
Mac Catalyst ✅, Supported 3.0.0 and newer

Mobile Operating Systems

Operating System Support Status Required Library Version
IOS 1.5.0 or newer
tvOS 1.5.2 or newer
watchOS 1.5.0 or newer
visionOS ❌, Not Supported N/A Not Supported
Android 1.5.0 or newer
Fire OS ❌, Not Supported N/A Not Supported
Android TV ❌, Not Supported N/A Not Supported
Tizen 2.0.0 or newer

License

OSCompatibilityLib is licensed under the MIT license.

Acknowledgements

This project makes use of the follwing 3rd party code or other works:

  • .NET API Docs for Polyfill class, property, and method xml doc comments
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.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.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 is compatible. 
.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.
  • .NETStandard 2.0

    • No dependencies.
  • .NETStandard 2.1

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.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.

Version Downloads Last updated
3.0.1 185 1/25/2025
3.0.0 130 1/18/2025

### Changes since 3.0.0
* Optimisations and Improvements
* Improved compatibility of IsOsVersionAtLeast methods