Skip to content

Commit

Permalink
Added support for detecting .NET 5.0+ as .NET Core
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennis Seller authored and AndersAbel committed Nov 25, 2021
1 parent 9362fc5 commit 6779ea7
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Sustainsys.Saml2/Internal/EnvironmentHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ namespace Sustainsys.Saml2.Internal
{
public class EnvironmentHelpers
{
public static bool IsNetCore =>
public static bool IsNetCore =>
#if NETSTANDARD2_0
RuntimeInformation.FrameworkDescription.
StartsWith(".NET Core", StringComparison.OrdinalIgnoreCase)
|| RuntimeInformation.FrameworkDescription.
StartsWith(".NET 5", StringComparison.OrdinalIgnoreCase);
// To support .NET 5.0 and up, specifically check if this is not .NET Framework.
// Since .NET 5.0, the description no longer starts with ".NET Core", but simply ".NET".
!RuntimeInformation.FrameworkDescription.StartsWith(".NET Framework", StringComparison.OrdinalIgnoreCase);
#else
// If not netstandard, then it is one of the .NET Framework targets. And
// obviously not running on core.
Expand Down

0 comments on commit 6779ea7

Please sign in to comment.