Removal of Microsoft.DotNet.PlatformAbstractions Package #18438
Labels
breaking-change
Indicates a .NET Core breaking change
🏁 Release: .NET 5
Work items for the .NET 5 release
doc-idea
Indicates issues that are suggestions for new topics [org][type][category]
Removal of Microsoft.DotNet.PlatformAbstractions Package
We will stop building new versions of Microsoft.DotNet.PlatformAbstractions in .NET 5
Version introduced
.NET 5.0 Preview 6
Old behavior
New versions of the
Microsoft.DotNet.PlatformAbstractions
library were produced alongside new versions of .NET Core.New behavior
New functionality and major versions of this library will no longer be produced.
Reason for change
As part of the ongoing repository consolidation effort in .NET 5, we have been examining the libraries that were previously in dotnet/core-setup and deciding on their long-term strategy/goals.
The Microsoft.DotNet.PlatformAbstractions library has considerable overlap with APIs that are already established in the System.* namespaces. Also, some PlatformAbstractions APIs were not designed with the same level of scrutiny and long-term supportability that the rest of the System.* APIs are designed. For example, PlatformAbstractions uses an enum named
Platform
to describe the current Operating System Platform. This design was explicitly rejected when designingRuntimeInformation.IsOSPlatform(OSPlatform)
to allow for new platforms and to allow the most flexibility in the future.To resolve this situation, we have ensured that the scenarios enabled by
Microsoft.DotNet.PlatformAbstractions
are now possible without it and plan to stop building new versions ofMicrosoft.DotNet.PlatformAbstractions
in .NET 5. The existing versions will continue to work, even in .NET 5, and be serviced along with previous versions of .NET Core. But new functionality won't be added to the library. New functionality will be added through other libraries and APIs.Recommended action
You can continue to use older versions of the library if they meet your requirements.
When the older version no longer meets your requirements, you can replace usages of the PlatformAbstractions APIs with the recommended API in the following table.
Note on OperatingSystem and OperatingSystemVersion
The majority of use cases for these APIs are for display purposes: displaying to a user, logging, telemetry, etc. Making runtime decisions on an operating system version (especially one that is of type
string
) is not a recommended practice. We have made enhancements toEnvironment.OSVersion.Version
to return 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 straight-forward. Do you want the Linux kernel version? The distro version? etc. For most Unix platforms,Environment.OSVersion.Version
andRuntimeInformation.OSDescription
continue to return the version returned by uname. For getting Linux distro name and version information, the recommended approach is to read the/etc/os-release
file.Category
Affected APIs
All under the
Microsoft.DotNet.PlatformAbstractions
namespace.Issue metadata
The text was updated successfully, but these errors were encountered: