diff --git a/Directory.Build.props b/Directory.Build.props
index 62f3090979..5883ab0920 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -8,14 +8,14 @@
$(NoWarn);NU5125;CS0618
MIT
10.0
-
-
- $(NetCurrent)
-
+
+ net8.0
+ net462
+ net481
-
- net7.0
+
+ $(NetCurrent)
diff --git a/Directory.Build.targets b/Directory.Build.targets
index 71391d2e99..d85abd78da 100644
--- a/Directory.Build.targets
+++ b/Directory.Build.targets
@@ -6,6 +6,7 @@
$(DefaultExcludesInProjectFolder);TestResults\**
+ false
diff --git a/Directory.Packages.props b/Directory.Packages.props
index f46c178e87..9c468f8ac2 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -14,16 +14,16 @@
-
-
-
+
+
+
-
+
diff --git a/System.CommandLine.v3.ncrunchsolution b/System.CommandLine.v3.ncrunchsolution
index 7d5820a216..f32e469597 100644
--- a/System.CommandLine.v3.ncrunchsolution
+++ b/System.CommandLine.v3.ncrunchsolution
@@ -2,8 +2,8 @@
True
- TargetFrameworks = net7.0
- TargetFramework = net7.0
+ TargetFrameworks = net8.0
+ TargetFramework = net8.0
True
diff --git a/samples/DragonFruit/DragonFruit.csproj b/samples/DragonFruit/DragonFruit.csproj
index 7c72c4da2b..ab9f75ed4c 100644
--- a/samples/DragonFruit/DragonFruit.csproj
+++ b/samples/DragonFruit/DragonFruit.csproj
@@ -1,8 +1,8 @@
+ $(NetMinimum)
Exe
- net7.0
true
diff --git a/samples/HostingPlayground/HostingPlayground.csproj b/samples/HostingPlayground/HostingPlayground.csproj
index 54bc18bb67..23bd95e28a 100644
--- a/samples/HostingPlayground/HostingPlayground.csproj
+++ b/samples/HostingPlayground/HostingPlayground.csproj
@@ -2,7 +2,7 @@
Exe
- net7.0
+ $(NetMinimum)
true
$(NoWarn);CS1591
diff --git a/samples/RenderingPlayground/RenderingPlayground.csproj b/samples/RenderingPlayground/RenderingPlayground.csproj
index 109f8622e1..6b95cadc76 100644
--- a/samples/RenderingPlayground/RenderingPlayground.csproj
+++ b/samples/RenderingPlayground/RenderingPlayground.csproj
@@ -1,8 +1,8 @@
+ $(NetMinimum)
Exe
- net7.0
true
diff --git a/src/Common/ArgumentBuilder.cs b/src/Common/ArgumentBuilder.cs
index 5d707e91ad..a233d29016 100644
--- a/src/Common/ArgumentBuilder.cs
+++ b/src/Common/ArgumentBuilder.cs
@@ -16,7 +16,7 @@ public static CliArgument CreateArgument(Type valueType, string name = "value")
{
var argumentType = typeof(CliArgument<>).MakeGenericType(valueType);
-#if NET6_0_OR_GREATER
+#if NET
var ctor = (ConstructorInfo)argumentType.GetMemberWithSameMetadataDefinitionAs(_ctor);
#else
var ctor = argumentType.GetConstructor(new[] { typeof(string) });
diff --git a/src/Common/OptionBuilder.cs b/src/Common/OptionBuilder.cs
index 768b3eddec..d5f0b40d33 100644
--- a/src/Common/OptionBuilder.cs
+++ b/src/Common/OptionBuilder.cs
@@ -18,7 +18,7 @@ internal static CliOption CreateOption(string name, Type valueType, string descr
{
var optionType = typeof(CliOption<>).MakeGenericType(valueType);
-#if NET6_0_OR_GREATER
+#if NET
var ctor = (ConstructorInfo)optionType.GetMemberWithSameMetadataDefinitionAs(_ctor);
#else
var ctor = optionType.GetConstructor(new[] { typeof(string), typeof(string[]) });
diff --git a/src/System.CommandLine.ApiCompatibility.Tests/ApiCompatibilityApprovalTests.System_CommandLine_api_is_not_changed.approved.txt b/src/System.CommandLine.ApiCompatibility.Tests/ApiCompatibilityApprovalTests.System_CommandLine_api_is_not_changed.approved.txt
index c3e8c803f5..b2a228caa8 100644
--- a/src/System.CommandLine.ApiCompatibility.Tests/ApiCompatibilityApprovalTests.System_CommandLine_api_is_not_changed.approved.txt
+++ b/src/System.CommandLine.ApiCompatibility.Tests/ApiCompatibilityApprovalTests.System_CommandLine_api_is_not_changed.approved.txt
@@ -252,7 +252,7 @@ System.CommandLine.Parsing
public System.Boolean Equals(CliToken other)
public System.Int32 GetHashCode()
public System.String ToString()
- public enum CliTokenType : System.Enum, System.IComparable, System.IConvertible, System.IFormattable
+ public enum CliTokenType : System.Enum, System.IComparable, System.IConvertible, System.IFormattable, System.ISpanFormattable
Argument=0
Command=1
Option=2
diff --git a/src/System.CommandLine.ApiCompatibility.Tests/System.CommandLine.ApiCompatibility.Tests.csproj b/src/System.CommandLine.ApiCompatibility.Tests/System.CommandLine.ApiCompatibility.Tests.csproj
index 670b1d0361..e35d58e30f 100644
--- a/src/System.CommandLine.ApiCompatibility.Tests/System.CommandLine.ApiCompatibility.Tests.csproj
+++ b/src/System.CommandLine.ApiCompatibility.Tests/System.CommandLine.ApiCompatibility.Tests.csproj
@@ -1,7 +1,7 @@
- $(TargetFrameworkForNETSDK)
+ $(NetMinimum)
false
diff --git a/src/System.CommandLine.Benchmarks/System.CommandLine.Benchmarks.csproj b/src/System.CommandLine.Benchmarks/System.CommandLine.Benchmarks.csproj
index cf5e9701f6..4e313c53f6 100644
--- a/src/System.CommandLine.Benchmarks/System.CommandLine.Benchmarks.csproj
+++ b/src/System.CommandLine.Benchmarks/System.CommandLine.Benchmarks.csproj
@@ -1,6 +1,9 @@
+
+ $(NetMinimum)
+
Exe
AnyCPU
@@ -8,9 +11,6 @@
and automation failing to clean up the folders once the runs are over -->
false
-
- $(TargetFrameworkForNETSDK)
-
False
diff --git a/src/System.CommandLine.DragonFruit.Tests/System.CommandLine.DragonFruit.Tests.csproj b/src/System.CommandLine.DragonFruit.Tests/System.CommandLine.DragonFruit.Tests.csproj
index e50606c1f9..5bf6a67097 100644
--- a/src/System.CommandLine.DragonFruit.Tests/System.CommandLine.DragonFruit.Tests.csproj
+++ b/src/System.CommandLine.DragonFruit.Tests/System.CommandLine.DragonFruit.Tests.csproj
@@ -1,7 +1,7 @@
- $(TargetFrameworkForNETSDK)
+ $(NetMinimum)
AutoGeneratedProgram
true
diff --git a/src/System.CommandLine.DragonFruit/System.CommandLine.DragonFruit.csproj b/src/System.CommandLine.DragonFruit/System.CommandLine.DragonFruit.csproj
index f3fc932610..a2a744ed67 100644
--- a/src/System.CommandLine.DragonFruit/System.CommandLine.DragonFruit.csproj
+++ b/src/System.CommandLine.DragonFruit/System.CommandLine.DragonFruit.csproj
@@ -1,7 +1,8 @@
+
- true
netstandard2.0
+ true
This package includes the experimental DragonFruit app model for System.CommandLine, which allows you to create a command line application using only a Main method while getting support for complex type binding, error reporting, help, shell completions, and more.
@@ -17,4 +18,5 @@
+
\ No newline at end of file
diff --git a/src/System.CommandLine.DragonFruit/targets/System.CommandLine.DragonFruit.props b/src/System.CommandLine.DragonFruit/targets/System.CommandLine.DragonFruit.props
index f0408287e8..59ac4bbc84 100644
--- a/src/System.CommandLine.DragonFruit/targets/System.CommandLine.DragonFruit.props
+++ b/src/System.CommandLine.DragonFruit/targets/System.CommandLine.DragonFruit.props
@@ -1,3 +1,4 @@
+
@@ -7,4 +8,5 @@
true
+
diff --git a/src/System.CommandLine.DragonFruit/targets/System.CommandLine.DragonFruit.targets b/src/System.CommandLine.DragonFruit/targets/System.CommandLine.DragonFruit.targets
index f3c5632a94..529b9a39f5 100644
--- a/src/System.CommandLine.DragonFruit/targets/System.CommandLine.DragonFruit.targets
+++ b/src/System.CommandLine.DragonFruit/targets/System.CommandLine.DragonFruit.targets
@@ -1,3 +1,4 @@
+
@@ -78,4 +79,5 @@
+
diff --git a/src/System.CommandLine.Generator.Tests/System.CommandLine.Generator.Tests.csproj b/src/System.CommandLine.Generator.Tests/System.CommandLine.Generator.Tests.csproj
index bac7e8a2d3..0d115bd133 100644
--- a/src/System.CommandLine.Generator.Tests/System.CommandLine.Generator.Tests.csproj
+++ b/src/System.CommandLine.Generator.Tests/System.CommandLine.Generator.Tests.csproj
@@ -1,7 +1,7 @@
- $(TargetFrameworkForNETSDK);$(NetFrameworkCurrent)
+ $(NetMinimum);$(NetFrameworkCurrent)
true
true
enable
diff --git a/src/System.CommandLine.Hosting.Tests/System.CommandLine.Hosting.Tests.csproj b/src/System.CommandLine.Hosting.Tests/System.CommandLine.Hosting.Tests.csproj
index d04c14b21f..6096060a87 100644
--- a/src/System.CommandLine.Hosting.Tests/System.CommandLine.Hosting.Tests.csproj
+++ b/src/System.CommandLine.Hosting.Tests/System.CommandLine.Hosting.Tests.csproj
@@ -1,8 +1,7 @@
- $(TargetFrameworkForNETSDK);$(NetFrameworkCurrent)
- false
+ $(NetMinimum);$(NetFrameworkCurrent)
diff --git a/src/System.CommandLine.Hosting/System.CommandLine.Hosting.csproj b/src/System.CommandLine.Hosting/System.CommandLine.Hosting.csproj
index a809c8cede..07d4a61bbc 100644
--- a/src/System.CommandLine.Hosting/System.CommandLine.Hosting.csproj
+++ b/src/System.CommandLine.Hosting/System.CommandLine.Hosting.csproj
@@ -1,15 +1,11 @@
+ $(NetMinimum);netstandard2.1;netstandard2.0
true
- netstandard2.0;netstandard2.1;$(TargetFrameworkForNETSDK)
This package provides support for using System.CommandLine with Microsoft.Extensions.Hosting.
-
- portable
-
-
true
diff --git a/src/System.CommandLine.NamingConventionBinder.Tests/ModelBinderTests.cs b/src/System.CommandLine.NamingConventionBinder.Tests/ModelBinderTests.cs
index f59a112d78..df7e5614a7 100644
--- a/src/System.CommandLine.NamingConventionBinder.Tests/ModelBinderTests.cs
+++ b/src/System.CommandLine.NamingConventionBinder.Tests/ModelBinderTests.cs
@@ -752,7 +752,7 @@ class DeployOptions
public string BundleId { get; set; }
}
-#if NETCOREAPP2_1_OR_GREATER
+#if NET
[Theory]
[InlineData("--class-with-span-ctor a51ca309-84fa-452f-96be-51e47702ffb4 --int-value 1234")]
[InlineData("--class-with-span-ctor a51ca309-84fa-452f-96be-51e47702ffb4")]
diff --git a/src/System.CommandLine.NamingConventionBinder.Tests/System.CommandLine.NamingConventionBinder.Tests.csproj b/src/System.CommandLine.NamingConventionBinder.Tests/System.CommandLine.NamingConventionBinder.Tests.csproj
index 602e726cc8..4586189ea2 100644
--- a/src/System.CommandLine.NamingConventionBinder.Tests/System.CommandLine.NamingConventionBinder.Tests.csproj
+++ b/src/System.CommandLine.NamingConventionBinder.Tests/System.CommandLine.NamingConventionBinder.Tests.csproj
@@ -1,8 +1,7 @@
- $(TargetFrameworkForNETSDK);$(NetFrameworkCurrent)
- 10
+ $(NetMinimum);$(NetFrameworkCurrent)
diff --git a/src/System.CommandLine.NamingConventionBinder/System.CommandLine.NamingConventionBinder.csproj b/src/System.CommandLine.NamingConventionBinder/System.CommandLine.NamingConventionBinder.csproj
index 8d941fdabd..80d013a4c9 100644
--- a/src/System.CommandLine.NamingConventionBinder/System.CommandLine.NamingConventionBinder.csproj
+++ b/src/System.CommandLine.NamingConventionBinder/System.CommandLine.NamingConventionBinder.csproj
@@ -1,20 +1,17 @@
+ $(NetMinimum);netstandard2.0
true
System.CommandLine.NamingConventionBinder
- $(TargetFrameworkForNETSDK);netstandard2.0
10
enable
This package provides command handler support for System.CommandLine performs parameter and model binding by matching option and argument names to parameter and property names.
true
-
- portable
-
-
+
diff --git a/src/System.CommandLine.Rendering.Tests/System.CommandLine.Rendering.Tests.csproj b/src/System.CommandLine.Rendering.Tests/System.CommandLine.Rendering.Tests.csproj
index a68721d089..468a27e56b 100644
--- a/src/System.CommandLine.Rendering.Tests/System.CommandLine.Rendering.Tests.csproj
+++ b/src/System.CommandLine.Rendering.Tests/System.CommandLine.Rendering.Tests.csproj
@@ -1,8 +1,7 @@
- $(TargetFrameworkForNETSDK)
- false
+ $(NetMinimum)
diff --git a/src/System.CommandLine.Rendering/System.CommandLine.Rendering.csproj b/src/System.CommandLine.Rendering/System.CommandLine.Rendering.csproj
index aeecd42acd..84da656bae 100644
--- a/src/System.CommandLine.Rendering/System.CommandLine.Rendering.csproj
+++ b/src/System.CommandLine.Rendering/System.CommandLine.Rendering.csproj
@@ -1,8 +1,8 @@
- true
netstandard2.0
+ true
This package provides support for structured command line output rendering. Write code once that renders correctly in multiple output modes, including System.Console, virtual terminal (using ANSI escape sequences), and plain text.
$(NoWarn);CS8632
diff --git a/src/System.CommandLine.Suggest.Tests/EndToEndTestApp/EndToEndTestApp.csproj b/src/System.CommandLine.Suggest.Tests/EndToEndTestApp/EndToEndTestApp.csproj
index a10ab84566..8bf9a7df6f 100644
--- a/src/System.CommandLine.Suggest.Tests/EndToEndTestApp/EndToEndTestApp.csproj
+++ b/src/System.CommandLine.Suggest.Tests/EndToEndTestApp/EndToEndTestApp.csproj
@@ -1,13 +1,13 @@
-
-
-
-
+ $(NetMinimum)
Exe
- $(TargetFrameworkForNETSDK)
win-x64;linux-x64;osx-x64
+
+
+
+
diff --git a/src/System.CommandLine.Suggest.Tests/dotnet-suggest.Tests.csproj b/src/System.CommandLine.Suggest.Tests/dotnet-suggest.Tests.csproj
index 5673048419..7ca6644de5 100644
--- a/src/System.CommandLine.Suggest.Tests/dotnet-suggest.Tests.csproj
+++ b/src/System.CommandLine.Suggest.Tests/dotnet-suggest.Tests.csproj
@@ -1,7 +1,7 @@
- $(TargetFrameworkForNETSDK)
+ $(NetMinimum)
$(DefaultExcludesInProjectFolder);EndToEndTestApp\**
diff --git a/src/System.CommandLine.Suggest/DotnetMuxer.cs b/src/System.CommandLine.Suggest/DotnetMuxer.cs
index 92612e7044..961b6a6b83 100644
--- a/src/System.CommandLine.Suggest/DotnetMuxer.cs
+++ b/src/System.CommandLine.Suggest/DotnetMuxer.cs
@@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-#if NET6_0_OR_GREATER
+#if NET
using System.IO;
using System.Runtime.InteropServices;
diff --git a/src/System.CommandLine.Suggest/dotnet-suggest.csproj b/src/System.CommandLine.Suggest/dotnet-suggest.csproj
index f0ae84d57d..8b03f7ca69 100644
--- a/src/System.CommandLine.Suggest/dotnet-suggest.csproj
+++ b/src/System.CommandLine.Suggest/dotnet-suggest.csproj
@@ -1,8 +1,8 @@
+ $(NetMinimum)
Exe
- $(TargetFrameworkForNETSDK)
true
true
dotnet-suggest
diff --git a/src/System.CommandLine.Tests/Binding/TypeConversionTests.cs b/src/System.CommandLine.Tests/Binding/TypeConversionTests.cs
index 6f6a15a5ea..a9b62061df 100644
--- a/src/System.CommandLine.Tests/Binding/TypeConversionTests.cs
+++ b/src/System.CommandLine.Tests/Binding/TypeConversionTests.cs
@@ -623,7 +623,7 @@ public void Values_can_be_correctly_converted_to_ipaddress_when_custom_parser_is
GetValue(option, "-us 1.2.3.4").Should().Be(IPAddress.Parse("1.2.3.4"));
}
-#if NETCOREAPP3_0_OR_GREATER
+#if NET
[Fact]
public void Values_can_be_correctly_converted_to_ipendpoint_when_custom_parser_is_provided()
{
@@ -636,7 +636,7 @@ public void Values_can_be_correctly_converted_to_ipendpoint_when_custom_parser_i
}
#endif
-#if NET6_0_OR_GREATER
+#if NET
[Fact]
public void Values_can_be_correctly_converted_to_dateonly_without_the_parser_specifying_a_custom_converter()
=> GetValue(new CliOption("-us"), "-us 2022-03-02").Should().Be(DateOnly.Parse("2022-03-02"));
diff --git a/src/System.CommandLine.Tests/CompilationTests.cs b/src/System.CommandLine.Tests/CompilationTests.cs
index c2b43b708e..873c00c54c 100644
--- a/src/System.CommandLine.Tests/CompilationTests.cs
+++ b/src/System.CommandLine.Tests/CompilationTests.cs
@@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-#if NET6_0_OR_GREATER
+#if NET
using System.CommandLine.Suggest;
using System.CommandLine.Tests.Utility;
@@ -17,13 +17,10 @@ namespace System.CommandLine.Tests;
public class CompilationTests
{
private readonly ITestOutputHelper _output;
- private readonly string _systemCommandLineDllPath;
public CompilationTests(ITestOutputHelper output)
{
_output = output;
-
- _systemCommandLineDllPath = typeof(CliCommand).Assembly.Location;
}
[ReleaseBuildOnlyTheory]
@@ -57,9 +54,8 @@ private void PublishAndValidate(string appName, string warningText, string addit
workingDirectory: workingDirectory);
string publishCommand = string.Format(
- "publish -c Release -r {0} --self-contained -p:SystemCommandLineDllPath=\"{1}\" -p:TreatWarningsAsErrors=true {2}",
+ "publish -c Release -r {0} --self-contained -p:TreatWarningsAsErrors=true {1}",
rId,
- _systemCommandLineDllPath,
additionalArgs);
var exitCode = Process.RunToCompletion(
diff --git a/src/System.CommandLine.Tests/CompletionTests.cs b/src/System.CommandLine.Tests/CompletionTests.cs
index 6e9b918051..67fe46d68f 100644
--- a/src/System.CommandLine.Tests/CompletionTests.cs
+++ b/src/System.CommandLine.Tests/CompletionTests.cs
@@ -782,12 +782,12 @@ public void When_parsing_from_text_if_the_proximate_option_is_completed_then_com
{
var command = new CliRootCommand
{
- CreateOptionWithAcceptOnlyFromAmong(name: "--framework", "net7.0"),
+ CreateOptionWithAcceptOnlyFromAmong(name: "--framework", "net8.0"),
CreateOptionWithAcceptOnlyFromAmong(name: "--language", "C#"),
new CliOption("--langVersion")
};
var configuration = new CliConfiguration(command);
- var completions = command.Parse("--framework net7.0 --l", configuration).GetCompletions();
+ var completions = command.Parse("--framework net8.0 --l", configuration).GetCompletions();
completions.Select(item => item.Label)
.Should()
@@ -799,12 +799,12 @@ public void When_parsing_from_array_if_the_proximate_option_is_completed_then_co
{
var command = new CliRootCommand
{
- CreateOptionWithAcceptOnlyFromAmong(name: "--framework", "net7.0"),
+ CreateOptionWithAcceptOnlyFromAmong(name: "--framework", "net8.0"),
CreateOptionWithAcceptOnlyFromAmong(name: "--language", "C#"),
new CliOption("--langVersion")
};
var configuration = new CliConfiguration(command);
- var completions = command.Parse(new[]{"--framework","net7.0","--l"}, configuration).GetCompletions();
+ var completions = command.Parse(new[]{"--framework","net8.0","--l"}, configuration).GetCompletions();
completions.Select(item => item.Label)
.Should()
diff --git a/src/System.CommandLine.Tests/System.CommandLine.Tests.csproj b/src/System.CommandLine.Tests/System.CommandLine.Tests.csproj
index 8bbb414657..f70e8472d9 100644
--- a/src/System.CommandLine.Tests/System.CommandLine.Tests.csproj
+++ b/src/System.CommandLine.Tests/System.CommandLine.Tests.csproj
@@ -1,16 +1,16 @@
- $(TargetFrameworkForNETSDK);$(NetFrameworkCurrent)
+ $(NetMinimum);$(NetFrameworkCurrent)
false
$(DefaultExcludesInProjectFolder);TestApps\**
-
+
-
+
@@ -18,7 +18,7 @@
-
+
diff --git a/src/System.CommandLine.Tests/TestApps/NativeAOT/NativeAOT.csproj b/src/System.CommandLine.Tests/TestApps/NativeAOT/NativeAOT.csproj
index 37f9b38667..3748b11a26 100644
--- a/src/System.CommandLine.Tests/TestApps/NativeAOT/NativeAOT.csproj
+++ b/src/System.CommandLine.Tests/TestApps/NativeAOT/NativeAOT.csproj
@@ -1,21 +1,14 @@
-
- Exe
- $(TargetFrameworkForNETSDK)
-
- false
+
+ $(NetMinimum)
+ Exe
true
-
+ false
+
-
- ..\..\..\System.CommandLine\bin\Release\$(TargetFrameworkForNETSDK)\System.CommandLine.dll
-
-
-
-
- $(SystemCommandLineDllPath)
-
-
+
+
+
diff --git a/src/System.CommandLine.Tests/TestApps/Trimming/Trimming.csproj b/src/System.CommandLine.Tests/TestApps/Trimming/Trimming.csproj
index 615b0764cf..4294cd1c4b 100644
--- a/src/System.CommandLine.Tests/TestApps/Trimming/Trimming.csproj
+++ b/src/System.CommandLine.Tests/TestApps/Trimming/Trimming.csproj
@@ -1,23 +1,20 @@
-
- Exe
- $(TargetFrameworkForNETSDK)
- enable
- enable
- true
- false
-
+
+ Exe
+ $(NetMinimum)
+ enable
+ enable
+ true
+ false
+
-
- ..\..\..\System.CommandLine\bin\Release\$(TargetFrameworkForNETSDK)\System.CommandLine.dll
-
+
+
+
-
-
- $(SystemCommandLineDllPath)
-
-
-
+
+
+
-
\ No newline at end of file
+
diff --git a/src/System.CommandLine/ArgumentValidation.cs b/src/System.CommandLine/ArgumentValidation.cs
index f5a418c5d8..11b2651858 100644
--- a/src/System.CommandLine/ArgumentValidation.cs
+++ b/src/System.CommandLine/ArgumentValidation.cs
@@ -82,7 +82,7 @@ private static void FileOrDirectoryExists(ArgumentResult result)
if (checkFile && checkDirectory)
{
-#if NET7_0_OR_GREATER
+#if NET
if (!Path.Exists(token.Value))
#else
if (!Directory.Exists(token.Value) && !File.Exists(token.Value))
diff --git a/src/System.CommandLine/Argument{T}.cs b/src/System.CommandLine/Argument{T}.cs
index 8cf1981020..397a374304 100644
--- a/src/System.CommandLine/Argument{T}.cs
+++ b/src/System.CommandLine/Argument{T}.cs
@@ -169,7 +169,7 @@ public void AcceptLegalFileNamesOnly()
{
if (default(T) is null && typeof(T) != typeof(string))
{
-#if NET7_0_OR_GREATER
+#if NET
if (typeof(T).IsSZArray)
#else
if (typeof(T).IsArray && typeof(T).GetArrayRank() == 1)
diff --git a/src/System.CommandLine/Binding/ArgumentConverter.DefaultValues.cs b/src/System.CommandLine/Binding/ArgumentConverter.DefaultValues.cs
index a44a8114d9..e19037b719 100644
--- a/src/System.CommandLine/Binding/ArgumentConverter.DefaultValues.cs
+++ b/src/System.CommandLine/Binding/ArgumentConverter.DefaultValues.cs
@@ -10,7 +10,7 @@ namespace System.CommandLine.Binding;
internal static partial class ArgumentConverter
{
-#if NET6_0_OR_GREATER
+#if NET
private static ConstructorInfo? _listCtor;
#endif
@@ -20,7 +20,7 @@ private static Array CreateArray(Type itemType, int capacity)
private static IList CreateEmptyList(Type listType)
{
-#if NET6_0_OR_GREATER
+#if NET
ConstructorInfo? listCtor = _listCtor;
if (listCtor is null)
diff --git a/src/System.CommandLine/Binding/ArgumentConverter.StringConverters.cs b/src/System.CommandLine/Binding/ArgumentConverter.StringConverters.cs
index 4a48afbb34..7829f4f32b 100644
--- a/src/System.CommandLine/Binding/ArgumentConverter.StringConverters.cs
+++ b/src/System.CommandLine/Binding/ArgumentConverter.StringConverters.cs
@@ -27,7 +27,7 @@ private static Dictionary StringConverters
return false;
},
-#if NET6_0_OR_GREATER
+#if NET
[typeof(DateOnly)] = (string input, out object? value) =>
{
if (DateOnly.TryParse(input, out var parsed))
@@ -195,7 +195,7 @@ private static Dictionary StringConverters
return false;
},
-#if NET6_0_OR_GREATER
+#if NET
[typeof(TimeOnly)] = (string input, out object? value) =>
{
if (TimeOnly.TryParse(input, out var parsed))
diff --git a/src/System.CommandLine/Binding/ArgumentConverter.cs b/src/System.CommandLine/Binding/ArgumentConverter.cs
index 9fa921348a..37d84e0aac 100644
--- a/src/System.CommandLine/Binding/ArgumentConverter.cs
+++ b/src/System.CommandLine/Binding/ArgumentConverter.cs
@@ -61,7 +61,7 @@ private static ArgumentConversionResult ConvertToken(
if (type.IsEnum)
{
-#if NET7_0_OR_GREATER
+#if NET
if (Enum.TryParse(type, value, ignoreCase: true, out var converted))
{
return Success(argumentResult, converted);
diff --git a/src/System.CommandLine/ConsoleHelpers.cs b/src/System.CommandLine/ConsoleHelpers.cs
index 2684413c89..46c91fb4e3 100644
--- a/src/System.CommandLine/ConsoleHelpers.cs
+++ b/src/System.CommandLine/ConsoleHelpers.cs
@@ -10,7 +10,7 @@ internal static class ConsoleHelpers
private static readonly bool ColorsAreSupported = GetColorsAreSupported();
private static bool GetColorsAreSupported()
-#if NET7_0_OR_GREATER
+#if NET
=> !(OperatingSystem.IsBrowser() || OperatingSystem.IsAndroid() || OperatingSystem.IsIOS() || OperatingSystem.IsTvOS())
#else
=> !(RuntimeInformation.IsOSPlatform(OSPlatform.Create("BROWSER"))
diff --git a/src/System.CommandLine/Invocation/ProcessTerminationHandler.cs b/src/System.CommandLine/Invocation/ProcessTerminationHandler.cs
index ead35b4eb0..4d273e5f4a 100644
--- a/src/System.CommandLine/Invocation/ProcessTerminationHandler.cs
+++ b/src/System.CommandLine/Invocation/ProcessTerminationHandler.cs
@@ -16,7 +16,7 @@ internal sealed class ProcessTerminationHandler : IDisposable
private readonly CancellationTokenSource _handlerCancellationTokenSource;
private readonly Task _startedHandler;
private readonly TimeSpan _processTerminationTimeout;
-#if NET7_0_OR_GREATER
+#if NET
private readonly IDisposable? _sigIntRegistration, _sigTermRegistration;
#endif
@@ -30,7 +30,7 @@ internal ProcessTerminationHandler(
_startedHandler = startedHandler;
_processTerminationTimeout = processTerminationTimeout;
-#if NET7_0_OR_GREATER // we prefer the new API as they allow for cancelling SIGTERM
+#if NET // we prefer the new API as they allow for cancelling SIGTERM
if (!OperatingSystem.IsAndroid()
&& !OperatingSystem.IsIOS()
&& !OperatingSystem.IsTvOS()
@@ -48,7 +48,7 @@ internal ProcessTerminationHandler(
public void Dispose()
{
-#if NET7_0_OR_GREATER
+#if NET
if (_sigIntRegistration is not null)
{
_sigIntRegistration.Dispose();
@@ -61,7 +61,7 @@ public void Dispose()
AppDomain.CurrentDomain.ProcessExit -= OnProcessExit;
}
-#if NET7_0_OR_GREATER
+#if NET
void OnPosixSignal(PosixSignalContext context)
{
context.Cancel = true;
diff --git a/src/System.CommandLine/System.CommandLine.csproj b/src/System.CommandLine/System.CommandLine.csproj
index 17a23bebad..31590c58ac 100644
--- a/src/System.CommandLine/System.CommandLine.csproj
+++ b/src/System.CommandLine/System.CommandLine.csproj
@@ -1,9 +1,9 @@
+ $(NetMinimum);netstandard2.0
true
System.CommandLine
- $(TargetFrameworkForNETSDK);netstandard2.0
enable
true
latest
@@ -11,16 +11,12 @@
true
-
+
true
true
true
-
- portable
-
-
diff --git a/src/System.CommandLine/System.Diagnostics.CodeAnalysis/DynamicallyAccessedMemberTypes.cs b/src/System.CommandLine/System.Diagnostics.CodeAnalysis/DynamicallyAccessedMemberTypes.cs
index a139bdc050..ab74d4d079 100644
--- a/src/System.CommandLine/System.Diagnostics.CodeAnalysis/DynamicallyAccessedMemberTypes.cs
+++ b/src/System.CommandLine/System.Diagnostics.CodeAnalysis/DynamicallyAccessedMemberTypes.cs
@@ -1,6 +1,6 @@
// adapted from: https://github.com/dotnet/aspnetcore/blob/404d81767784552b0a148cb8c437332ebe726ae9/src/Shared/CodeAnalysis/DynamicallyAccessedMemberTypes.cs
-#if !NET6_0_OR_GREATER
+#if !NET
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
diff --git a/src/System.CommandLine/System.Diagnostics.CodeAnalysis/DynamicallyAccessedMembersAttribute.cs b/src/System.CommandLine/System.Diagnostics.CodeAnalysis/DynamicallyAccessedMembersAttribute.cs
index a39283b0ab..509c9cdb51 100644
--- a/src/System.CommandLine/System.Diagnostics.CodeAnalysis/DynamicallyAccessedMembersAttribute.cs
+++ b/src/System.CommandLine/System.Diagnostics.CodeAnalysis/DynamicallyAccessedMembersAttribute.cs
@@ -1,6 +1,6 @@
// adapted from: https://github.com/dotnet/aspnetcore/blob/404d81767784552b0a148cb8c437332ebe726ae9/src/Shared/CodeAnalysis/DynamicallyAccessedMembersAttribute.cs#L29
-#if !NET6_0_OR_GREATER
+#if !NET
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
diff --git a/src/System.CommandLine/System.Diagnostics.CodeAnalysis/UnconditionalSuppressMessageAttribute.cs b/src/System.CommandLine/System.Diagnostics.CodeAnalysis/UnconditionalSuppressMessageAttribute.cs
index 8c54ed2c91..8a717eb5ad 100644
--- a/src/System.CommandLine/System.Diagnostics.CodeAnalysis/UnconditionalSuppressMessageAttribute.cs
+++ b/src/System.CommandLine/System.Diagnostics.CodeAnalysis/UnconditionalSuppressMessageAttribute.cs
@@ -1,6 +1,6 @@
// adapted from: https://github.com/dotnet/runtime/blob/a5159b1a8840632ad34cf59c5aaf77040cb6ceda/src/libraries/System.Private.CoreLib/src/System/Diagnostics/CodeAnalysis/UnconditionalSuppressMessageAttribute.cs#L21
-#if !NET6_0_OR_GREATER
+#if !NET
// Licensed to the .NET Foundation under one or more agreements.
diff --git a/src/System.Diagnostics.CodeAnalysis.cs b/src/System.Diagnostics.CodeAnalysis.cs
index 8a5b242094..53a18265de 100644
--- a/src/System.Diagnostics.CodeAnalysis.cs
+++ b/src/System.Diagnostics.CodeAnalysis.cs
@@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-#if !NET6_0_OR_GREATER
+#if !NET
#pragma warning disable CA1801, CA1822