Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use NetMinimum and NetFrameworkMinimum floating TFMs #2335

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
<NoWarn>$(NoWarn);NU5125;CS0618</NoWarn>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<LangVersion>10.0</LangVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(DotNetBuildFromSource)' == 'true' or '$(DotNetBuildSourceOnly)' == 'true'">
<TargetFrameworkForNETSDK>$(NetCurrent)</TargetFrameworkForNETSDK>
</PropertyGroup>
<!-- Hardcode these properties to support building without the Arcade SDK. -->
<NetMinimum>net8.0</NetMinimum>
<NetFrameworkMinimum>net462</NetFrameworkMinimum>
<NetFrameworkCurrent>net481</NetFrameworkCurrent>

<PropertyGroup Condition="'$(DotNetBuildFromSource)' != 'true' and '$(DotNetBuildSourceOnly)' != 'true'">
<TargetFrameworkForNETSDK>net7.0</TargetFrameworkForNETSDK>
<!-- When building from source, upgrade NetMinimum to the latest TFM. -->
<NetMinimum Condition="'$(DotNetBuildFromSource)' == 'true' or '$(DotNetBuildSourceOnly)' == 'true'">$(NetCurrent)</NetMinimum>
</PropertyGroup>

</Project>
1 change: 1 addition & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

<PropertyGroup Condition="'$(DisableArcade)' == '1' and $(MSBuildProjectName.EndsWith('.Tests'))">
<DefaultExcludesInProjectFolder>$(DefaultExcludesInProjectFolder);TestResults\**</DefaultExcludesInProjectFolder>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup Condition="'$(DisableArcade)' == '1' and $(MSBuildProjectName.EndsWith('.Tests'))">
Expand Down
8 changes: 4 additions & 4 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.0.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.0.1" />
<!-- Runtime dependencies -->
<PackageVersion Include="Microsoft.Extensions.Configuration.CommandLine" Version="6.0.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="6.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.CommandLine" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<!-- external dependencies -->
<PackageVersion Include="ApprovalTests" Version="7.0.0-beta.3" />
<PackageVersion Include="BenchmarkDotNet" Version="0.13.1" />
<PackageVersion Include="FluentAssertions" Version="5.10.3" />
<PackageVersion Include="Microsoft.CSharp" Version="4.7.0" />
<PackageVersion Include="Microsoft.DotNet.PlatformAbstractions" Version="3.1.6" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.2" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="System.Memory" Version="4.5.4" />
<PackageVersion Include="system.reactive.core" Version="5.0.0" />
</ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions System.CommandLine.v3.ncrunchsolution
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<Settings>
<AllowParallelTestExecution>True</AllowParallelTestExecution>
<CustomBuildProperties>
<Value>TargetFrameworks = net7.0</Value>
<Value>TargetFramework = net7.0</Value>
<Value>TargetFrameworks = net8.0</Value>
<Value>TargetFramework = net8.0</Value>
</CustomBuildProperties>
<SolutionConfigured>True</SolutionConfigured>
</Settings>
Expand Down
2 changes: 1 addition & 1 deletion samples/DragonFruit/DragonFruit.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>$(NetMinimum)</TargetFramework>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion samples/HostingPlayground/HostingPlayground.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>$(NetMinimum)</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);CS1591</NoWarn>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion samples/RenderingPlayground/RenderingPlayground.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>$(NetMinimum)</TargetFramework>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/Common/ArgumentBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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) });
Expand Down
2 changes: 1 addition & 1 deletion src/Common/OptionBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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[]) });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>$(TargetFrameworkForNETSDK)</TargetFramework>
<TargetFramework>$(NetMinimum)</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<!-- Supported target frameworks -->
<TargetFramework>$(NetMinimum)</TargetFramework>

<OutputType>Exe</OutputType>
<PlatformTarget>AnyCPU</PlatformTarget>

<!-- Avoid spawning any-long living compiler processes to avoid BenchmarkDotNet issues with "file in use",
and automation failing to clean up the folders once the runs are over -->
<UseSharedCompilation>false</UseSharedCompilation>

<!-- Supported target frameworks -->
<TargetFramework>$(TargetFrameworkForNETSDK)</TargetFramework>

<!-- This repo does not produce any libraries, therefore generating docs is disabled -->
<GenerateDocumentationFile>False</GenerateDocumentationFile>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>$(TargetFrameworkForNETSDK)</TargetFramework>
<TargetFramework>$(NetMinimum)</TargetFramework>
<StartupObject>AutoGeneratedProgram</StartupObject>
<!-- Ensure that an XML doc file is emitted to supply command line help -->
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<IsPackable>true</IsPackable>
<TargetFramework>netstandard2.0</TargetFramework>
<IsPackable>true</IsPackable>
<Description>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.
</Description>
</PropertyGroup>
Expand All @@ -17,4 +18,5 @@
<Compile Include="..\Common\ArgumentBuilder.cs" Link="Utility\ArgumentBuilder.cs" />
<Compile Include="..\Common\OptionBuilder.cs" Link="Utility\OptionBuilder.cs" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. -->
<Project>

<PropertyGroup>
Expand All @@ -7,4 +8,5 @@
<!-- Ensure that an XML doc file is emitted to supply command line help -->
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. -->
<Project>

<PropertyGroup Condition="'$(AutoGenerateEntryPoint)' == 'true'">
Expand Down Expand Up @@ -78,4 +79,5 @@
<Compile Include="$(_GeneratedEntryPointFile)" />
</ItemGroup>
</Target>

</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>$(TargetFrameworkForNETSDK);$(NetFrameworkCurrent)</TargetFrameworks>
<TargetFrameworks>$(NetMinimum);$(NetFrameworkCurrent)</TargetFrameworks>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
<Nullable>enable</Nullable>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>$(TargetFrameworkForNETSDK);$(NetFrameworkCurrent)</TargetFrameworks>
<IsPackable>false</IsPackable>
<TargetFrameworks>$(NetMinimum);$(NetFrameworkCurrent)</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>$(NetMinimum);netstandard2.1;netstandard2.0</TargetFrameworks>
<IsPackable>true</IsPackable>
<TargetFrameworks>netstandard2.0;netstandard2.1;$(TargetFrameworkForNETSDK)</TargetFrameworks>
<Description>This package provides support for using System.CommandLine with Microsoft.Extensions.Hosting.</Description>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DebugType>portable</DebugType>
</PropertyGroup>

<PropertyGroup>
<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>$(TargetFrameworkForNETSDK);$(NetFrameworkCurrent)</TargetFrameworks>
<LangVersion>10</LangVersion>
ViktorHofer marked this conversation as resolved.
Show resolved Hide resolved
<TargetFrameworks>$(NetMinimum);$(NetFrameworkCurrent)</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>$(NetMinimum);netstandard2.0</TargetFrameworks>
<IsPackable>true</IsPackable>
<PackageId>System.CommandLine.NamingConventionBinder</PackageId>
<TargetFrameworks>$(TargetFrameworkForNETSDK);netstandard2.0</TargetFrameworks>
<LangVersion>10</LangVersion>
<Nullable>enable</Nullable>
<Description>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.</Description>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DebugType>portable</DebugType>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\System.CommandLine\System.CommandLine.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>$(TargetFrameworkForNETSDK)</TargetFramework>
<IsPackable>false</IsPackable>
<TargetFramework>$(NetMinimum)</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<IsPackable>true</IsPackable>
<TargetFramework>netstandard2.0</TargetFramework>
<IsPackable>true</IsPackable>
<Description>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.
</Description>
<NoWarn>$(NoWarn);CS8632</NoWarn> <!-- some types provide nullable annotations -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<ItemGroup>
<ProjectReference Include="..\..\System.CommandLine\System.CommandLine.csproj" />
</ItemGroup>

<PropertyGroup>
<TargetFramework>$(NetMinimum)</TargetFramework>
<OutputType>Exe</OutputType>
<TargetFramework>$(TargetFrameworkForNETSDK)</TargetFramework>
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\System.CommandLine\System.CommandLine.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>$(TargetFrameworkForNETSDK)</TargetFramework>
<TargetFramework>$(NetMinimum)</TargetFramework>
<DefaultExcludesInProjectFolder>$(DefaultExcludesInProjectFolder);EndToEndTestApp\**</DefaultExcludesInProjectFolder>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/System.CommandLine.Suggest/DotnetMuxer.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/System.CommandLine.Suggest/dotnet-suggest.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>$(NetMinimum)</TargetFramework>
<OutputType>Exe</OutputType>
<TargetFramework>$(TargetFrameworkForNETSDK)</TargetFramework>
<IsPackable>true</IsPackable>
<PackAsTool>true</PackAsTool>
<PackageId>dotnet-suggest</PackageId>
Expand Down
4 changes: 2 additions & 2 deletions src/System.CommandLine.Tests/Binding/TypeConversionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand All @@ -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<DateOnly>("-us"), "-us 2022-03-02").Should().Be(DateOnly.Parse("2022-03-02"));
Expand Down
8 changes: 2 additions & 6 deletions src/System.CommandLine.Tests/CompilationTests.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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]
Expand Down Expand Up @@ -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(
Expand Down
Loading