Microsoft.DotNet.PlatformAbstractions package removed
No new versions of the Microsoft.DotNet.PlatformAbstractions NuGet package will be produced.
Change description
Previously, new versions of the Microsoft.DotNet.PlatformAbstractions library were produced alongside new versions of .NET Core. Going forward, no new functionality will be added to the library, and no new major versions will be released. However, existing versions of the library will continue to work and be serviced.
The Microsoft.DotNet.PlatformAbstractions library overlaps with APIs that are already established in the System.* namespaces. Also, some Microsoft.DotNet.PlatformAbstractions APIs weren't designed with the same level of scrutiny and long-term supportability as the rest of the System.* APIs. For example, Microsoft.DotNet.PlatformAbstractions uses the Platform
enumeration to describe the current operating system platform. This enumeration design was explicitly rejected when the RuntimeInformation.IsOSPlatform(OSPlatform) API was designed, to allow for new platforms and future flexibility.
The scenarios enabled by the Microsoft.DotNet.PlatformAbstractions library are now possible without it. Existing versions will continue to work, even in .NET 5 and later, and will be serviced along with previous versions of .NET Core. However, new functionality won't be added to the library. Instead, new functionality will be added to other libraries and APIs.
Version introduced
5.0
Recommended action
You can continue to use older versions of the library if they meet your requirements.
If the older versions don't meet your requirements, replace usages of the
PlatformAbstractions
APIs with the recommended replacements.PlatformAbstractions
APIRecommended replacement ApplicationEnvironment.ApplicationBasePath
AppContext.BaseDirectory HashCodeCombiner System.HashCode RuntimeEnvironment.GetRuntimeIdentifier()
RuntimeInformation.RuntimeIdentifier RuntimeEnvironment.OperatingSystemPlatform
RuntimeInformation.IsOSPlatform(OSPlatform) RuntimeEnvironment.RuntimeArchitecture
RuntimeInformation.ProcessArchitecture RuntimeEnvironment.OperatingSystem
RuntimeInformation.OSDescription RuntimeEnvironment.OperatingSystemVersion
RuntimeInformation.OSDescription and Environment.OSVersion Note
Most use cases for
RuntimeEnvironment.OperatingSystem
andRuntimeEnvironment.OperatingSystemVersion
are for display purposes, for example, displaying to a user, logging, and telemetry. It's not recommended to make run-time decisions based on an operating system (OS) version. Environment.OSVersion now returns the correct version for Windows and macOS operating systems. However, for most Unix distributions, what is considered to be the "OS version" is not as straightforward. For example, it could be the Linux kernel version, or it could be the distro version. For most Unix platforms, Environment.OSVersion and RuntimeInformation.OSDescription return the version that's returned byuname
. To get the Linux distro name and version information, the recommended approach is to read the /etc/os-release file.
Affected APIs
Microsoft.DotNet.PlatformAbstractions.ApplicationEnvironment.ApplicationBasePath
- Microsoft.DotNet.PlatformAbstractions.HashCodeCombiner
Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment.GetRuntimeIdentifier()
Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment.OperatingSystem
Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment.OperatingSystemPlatform
Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment.OperatingSystemVersion
Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment.RuntimeArchitecture