From 540609e10236a273272a807e3d30bb2aefcd2e16 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Sun, 10 Jan 2021 23:11:12 -0800 Subject: [PATCH 1/2] feat: support .NET Standard 2.1 --- .../McMaster.Extensions.CommandLineUtils.csproj | 5 +++-- .../McMaster.Extensions.Hosting.CommandLine.csproj | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/CommandLineUtils/McMaster.Extensions.CommandLineUtils.csproj b/src/CommandLineUtils/McMaster.Extensions.CommandLineUtils.csproj index fbed55fc..40c5d683 100644 --- a/src/CommandLineUtils/McMaster.Extensions.CommandLineUtils.csproj +++ b/src/CommandLineUtils/McMaster.Extensions.CommandLineUtils.csproj @@ -1,7 +1,8 @@  - netstandard2.0;net45 + netstandard2.1;netstandard2.0;net45 + annotations true true Command-line parsing API. @@ -20,7 +21,7 @@ McMaster.Extensions.CommandLineUtils.ArgumentEscaper commandline;parsing - + diff --git a/src/Hosting.CommandLine/McMaster.Extensions.Hosting.CommandLine.csproj b/src/Hosting.CommandLine/McMaster.Extensions.Hosting.CommandLine.csproj index c17a9713..3173729b 100644 --- a/src/Hosting.CommandLine/McMaster.Extensions.Hosting.CommandLine.csproj +++ b/src/Hosting.CommandLine/McMaster.Extensions.Hosting.CommandLine.csproj @@ -1,7 +1,7 @@ - netstandard2.0 + netstandard2.1;netstandard2.0 true true Provides command-line parsing API integration with the generic host API (Microsoft.Extensions.Hosting). From c2bbaec6ad569b907857afa0fb568096e840d863 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Sat, 16 Jan 2021 13:26:53 -0800 Subject: [PATCH 2/2] fixup! feat: support .NET Standard 2.1 --- src/CommandLineUtils/IO/Pager.cs | 2 +- src/CommandLineUtils/Internal/Util.cs | 2 +- src/CommandLineUtils/Utilities/DotNetExe.cs | 2 +- test/CommandLineUtils.Tests/DotNetExeTests.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/CommandLineUtils/IO/Pager.cs b/src/CommandLineUtils/IO/Pager.cs index 92951176..9aa7da7e 100644 --- a/src/CommandLineUtils/IO/Pager.cs +++ b/src/CommandLineUtils/IO/Pager.cs @@ -45,7 +45,7 @@ public Pager(IConsole console) #if NET45 // if .NET Framework, assume we're on Windows unless it's running on Mono. _enabled = Type.GetType("Mono.Runtime") != null; -#elif NETSTANDARD2_0 +#elif NETSTANDARD2_0 || NETSTANDARD2_1 _enabled = !RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && !console.IsOutputRedirected; #else #error Update target frameworks diff --git a/src/CommandLineUtils/Internal/Util.cs b/src/CommandLineUtils/Internal/Util.cs index 943aa53f..8a11fdfd 100644 --- a/src/CommandLineUtils/Internal/Util.cs +++ b/src/CommandLineUtils/Internal/Util.cs @@ -16,7 +16,7 @@ private static class EmptyArrayCache internal static readonly T[] Value = new T[0]; } -#elif NETSTANDARD2_0 +#elif NETSTANDARD2_0 || NETSTANDARD2_1 => Array.Empty(); #else #error Update target frameworks diff --git a/src/CommandLineUtils/Utilities/DotNetExe.cs b/src/CommandLineUtils/Utilities/DotNetExe.cs index 14e88cff..73d20585 100644 --- a/src/CommandLineUtils/Utilities/DotNetExe.cs +++ b/src/CommandLineUtils/Utilities/DotNetExe.cs @@ -45,7 +45,7 @@ public static string FullPathOrDefault() var fileName = FileName; #if NET45 fileName += ".exe"; -#elif NETSTANDARD2_0 +#elif NETSTANDARD2_0 || NETSTANDARD2_1 if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { fileName += ".exe"; diff --git a/test/CommandLineUtils.Tests/DotNetExeTests.cs b/test/CommandLineUtils.Tests/DotNetExeTests.cs index 96b13d1b..3b9a9aca 100644 --- a/test/CommandLineUtils.Tests/DotNetExeTests.cs +++ b/test/CommandLineUtils.Tests/DotNetExeTests.cs @@ -3,7 +3,7 @@ // This file has been modified from the original form. See Notice.txt in the project root for more information. -#if NETCOREAPP +#if NETCOREAPP || NET5_0 using System.IO; using Xunit;