From 3940bf3e4b2cbeaa6601c00b427cef2119b52c16 Mon Sep 17 00:00:00 2001 From: "Dominik.Kotecki" Date: Sat, 18 Nov 2023 14:41:20 +0100 Subject: [PATCH 1/3] upgrade to net 8 --- .azure-pipelines/build.yml | 2 +- .github/workflows/build.yaml | 2 +- global.json | 2 +- .../Cocona.Benchmark.External.csproj | 14 +++++----- .../Commands/CliFxCommand.cs | 8 +++--- .../Cocona.Benchmark.Performance.csproj | 4 +-- ...le.Advanced.CommandMethodForwarding.csproj | 2 +- .../CoconaSample.Advanced.GenericHost.csproj | 2 +- .../CoconaSample.Advanced.HelpOnDemand.csproj | 2 +- ...conaSample.Advanced.HelpTransformer.csproj | 2 +- ...aSample.Advanced.JsonValueConverter.csproj | 2 +- .../CoconaSample.Advanced.Localization.csproj | 4 +-- ...naSample.Advanced.OptionLikeCommand.csproj | 2 +- ...e.Advanced.PreventMultipleInstances.csproj | 2 +- ....Advanced.ShellCompletionCandidates.csproj | 2 +- ...onaSample.GettingStarted.MinimalApp.csproj | 2 +- ...Sample.GettingStarted.SubCommandApp.csproj | 2 +- ...ple.GettingStarted.TypicalSimpleApp.csproj | 2 +- ...onaSample.InAction.AppConfiguration.csproj | 2 +- ...CoconaSample.InAction.CommandFilter.csproj | 2 +- ...mple.InAction.CommandOptionOverload.csproj | 2 +- ...oconaSample.InAction.CommandOptions.csproj | 2 +- ...Sample.InAction.DependencyInjection.csproj | 2 +- .../CoconaSample.InAction.ExitCode.csproj | 2 +- ...ample.InAction.HandleShutdownSignal.csproj | 2 +- ...CoconaSample.InAction.ManyArguments.csproj | 2 +- ...ample.InAction.MultipleCommandTypes.csproj | 2 +- .../CoconaSample.InAction.ParameterSet.csproj | 2 +- .../CoconaSample.InAction.Validation.csproj | 2 +- .../CoconaSample.MinimalApi.InAction.csproj | 2 +- ...aSample.MinimalApi.MultipleCommands.csproj | 2 +- .../CoconaSample.MinimalApi.QuickStart.csproj | 2 +- .../CoconaSample.MinimalApi.SubCommand.csproj | 2 +- src/Cocona.Core/Cocona.Core.csproj | 8 +++--- src/Cocona.Lite/Cocona.Lite.csproj | 4 +-- .../Builder/Internal/BootstrapHostBuilder.cs | 28 ++++++++++--------- .../Builder/Internal/CoconaAppHostOptions.cs | 2 +- .../Builder/Internal/ConfigureHostBuilder.cs | 2 +- src/Cocona/Cocona.csproj | 10 +++---- test/Cocona.Lite.Test/Cocona.Lite.Test.csproj | 18 ++++++++---- test/Cocona.Test/Cocona.Test.csproj | 18 ++++++++---- .../ParameterBinder/BindParameterTest.cs | 14 +++++----- 42 files changed, 103 insertions(+), 89 deletions(-) diff --git a/.azure-pipelines/build.yml b/.azure-pipelines/build.yml index 5aae598..fdecf38 100644 --- a/.azure-pipelines/build.yml +++ b/.azure-pipelines/build.yml @@ -23,7 +23,7 @@ jobs: - task: UseDotNet@2 inputs: packageType: 'sdk' - version: 7.0.x + version: 8.0.x - script: dotnet restore displayName: dotnet restore diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 0414384..036d4c7 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -21,7 +21,7 @@ jobs: dotnet-version: | 3.1.x 6.0.x - 7.0.x + 8.0.x # Build - run: dotnet restore diff --git a/global.json b/global.json index 1c7274b..501e79a 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "7.0.100", + "version": "8.0.100", "rollForward": "latestFeature" } } \ No newline at end of file diff --git a/perf/Cocona.Benchmark.External/Cocona.Benchmark.External.csproj b/perf/Cocona.Benchmark.External/Cocona.Benchmark.External.csproj index 9b74dc2..a62dd81 100644 --- a/perf/Cocona.Benchmark.External/Cocona.Benchmark.External.csproj +++ b/perf/Cocona.Benchmark.External/Cocona.Benchmark.External.csproj @@ -2,19 +2,19 @@ Exe - net6.0 + net8.0 enable annotations - - + + - - - - + + + + diff --git a/perf/Cocona.Benchmark.External/Commands/CliFxCommand.cs b/perf/Cocona.Benchmark.External/Commands/CliFxCommand.cs index 3566c99..6d73e06 100644 --- a/perf/Cocona.Benchmark.External/Commands/CliFxCommand.cs +++ b/perf/Cocona.Benchmark.External/Commands/CliFxCommand.cs @@ -1,5 +1,5 @@ using CliFx.Attributes; -using CliFx.Services; +using CliFx.Infrastructure; namespace Cocona.Benchmark.External.Commands; @@ -14,6 +14,6 @@ public class CliFxCommand : CliFx.ICommand [CommandOption("bool", 'b')] public bool BoolOption { get; set; } - - public Task ExecuteAsync(IConsole console) => Task.CompletedTask; -} \ No newline at end of file + + public ValueTask ExecuteAsync(IConsole console) => ValueTask.CompletedTask; +} diff --git a/perf/Cocona.Benchmark.Performance/Cocona.Benchmark.Performance.csproj b/perf/Cocona.Benchmark.Performance/Cocona.Benchmark.Performance.csproj index f3625a1..0ca757a 100644 --- a/perf/Cocona.Benchmark.Performance/Cocona.Benchmark.Performance.csproj +++ b/perf/Cocona.Benchmark.Performance/Cocona.Benchmark.Performance.csproj @@ -2,12 +2,12 @@ Exe - net6.0 + net8.0 enable - + diff --git a/samples/Advanced.CommandMethodForwarding/CoconaSample.Advanced.CommandMethodForwarding.csproj b/samples/Advanced.CommandMethodForwarding/CoconaSample.Advanced.CommandMethodForwarding.csproj index 3363f83..2823c13 100644 --- a/samples/Advanced.CommandMethodForwarding/CoconaSample.Advanced.CommandMethodForwarding.csproj +++ b/samples/Advanced.CommandMethodForwarding/CoconaSample.Advanced.CommandMethodForwarding.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 enable diff --git a/samples/Advanced.GenericHost/CoconaSample.Advanced.GenericHost.csproj b/samples/Advanced.GenericHost/CoconaSample.Advanced.GenericHost.csproj index 8b35a58..8d1e804 100644 --- a/samples/Advanced.GenericHost/CoconaSample.Advanced.GenericHost.csproj +++ b/samples/Advanced.GenericHost/CoconaSample.Advanced.GenericHost.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 enable diff --git a/samples/Advanced.HelpOnDemand/CoconaSample.Advanced.HelpOnDemand.csproj b/samples/Advanced.HelpOnDemand/CoconaSample.Advanced.HelpOnDemand.csproj index b2c77f9..fed6650 100644 --- a/samples/Advanced.HelpOnDemand/CoconaSample.Advanced.HelpOnDemand.csproj +++ b/samples/Advanced.HelpOnDemand/CoconaSample.Advanced.HelpOnDemand.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 enable diff --git a/samples/Advanced.HelpTransformer/CoconaSample.Advanced.HelpTransformer.csproj b/samples/Advanced.HelpTransformer/CoconaSample.Advanced.HelpTransformer.csproj index 1827e5f..8d11cd8 100644 --- a/samples/Advanced.HelpTransformer/CoconaSample.Advanced.HelpTransformer.csproj +++ b/samples/Advanced.HelpTransformer/CoconaSample.Advanced.HelpTransformer.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 enable diff --git a/samples/Advanced.JsonValueConverter/CoconaSample.Advanced.JsonValueConverter.csproj b/samples/Advanced.JsonValueConverter/CoconaSample.Advanced.JsonValueConverter.csproj index a59bb2a..934ff4d 100644 --- a/samples/Advanced.JsonValueConverter/CoconaSample.Advanced.JsonValueConverter.csproj +++ b/samples/Advanced.JsonValueConverter/CoconaSample.Advanced.JsonValueConverter.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 enable diff --git a/samples/Advanced.Localization/CoconaSample.Advanced.Localization.csproj b/samples/Advanced.Localization/CoconaSample.Advanced.Localization.csproj index e79f64e..e025a1b 100644 --- a/samples/Advanced.Localization/CoconaSample.Advanced.Localization.csproj +++ b/samples/Advanced.Localization/CoconaSample.Advanced.Localization.csproj @@ -2,13 +2,13 @@ Exe - net6.0 + net8.0 enable enable - + diff --git a/samples/Advanced.OptionLikeCommand/CoconaSample.Advanced.OptionLikeCommand.csproj b/samples/Advanced.OptionLikeCommand/CoconaSample.Advanced.OptionLikeCommand.csproj index 3363f83..2823c13 100644 --- a/samples/Advanced.OptionLikeCommand/CoconaSample.Advanced.OptionLikeCommand.csproj +++ b/samples/Advanced.OptionLikeCommand/CoconaSample.Advanced.OptionLikeCommand.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 enable diff --git a/samples/Advanced.PreventMultipleInstances/CoconaSample.Advanced.PreventMultipleInstances.csproj b/samples/Advanced.PreventMultipleInstances/CoconaSample.Advanced.PreventMultipleInstances.csproj index 8b35a58..8d1e804 100644 --- a/samples/Advanced.PreventMultipleInstances/CoconaSample.Advanced.PreventMultipleInstances.csproj +++ b/samples/Advanced.PreventMultipleInstances/CoconaSample.Advanced.PreventMultipleInstances.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 enable diff --git a/samples/Advanced.ShellCompletionCandidates/CoconaSample.Advanced.ShellCompletionCandidates.csproj b/samples/Advanced.ShellCompletionCandidates/CoconaSample.Advanced.ShellCompletionCandidates.csproj index 3363f83..2823c13 100644 --- a/samples/Advanced.ShellCompletionCandidates/CoconaSample.Advanced.ShellCompletionCandidates.csproj +++ b/samples/Advanced.ShellCompletionCandidates/CoconaSample.Advanced.ShellCompletionCandidates.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 enable diff --git a/samples/GettingStarted.MinimalApp/CoconaSample.GettingStarted.MinimalApp.csproj b/samples/GettingStarted.MinimalApp/CoconaSample.GettingStarted.MinimalApp.csproj index 8b35a58..8d1e804 100644 --- a/samples/GettingStarted.MinimalApp/CoconaSample.GettingStarted.MinimalApp.csproj +++ b/samples/GettingStarted.MinimalApp/CoconaSample.GettingStarted.MinimalApp.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 enable diff --git a/samples/GettingStarted.SubCommandApp/CoconaSample.GettingStarted.SubCommandApp.csproj b/samples/GettingStarted.SubCommandApp/CoconaSample.GettingStarted.SubCommandApp.csproj index 8b35a58..8d1e804 100644 --- a/samples/GettingStarted.SubCommandApp/CoconaSample.GettingStarted.SubCommandApp.csproj +++ b/samples/GettingStarted.SubCommandApp/CoconaSample.GettingStarted.SubCommandApp.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 enable diff --git a/samples/GettingStarted.TypicalSimpleApp/CoconaSample.GettingStarted.TypicalSimpleApp.csproj b/samples/GettingStarted.TypicalSimpleApp/CoconaSample.GettingStarted.TypicalSimpleApp.csproj index 8b35a58..8d1e804 100644 --- a/samples/GettingStarted.TypicalSimpleApp/CoconaSample.GettingStarted.TypicalSimpleApp.csproj +++ b/samples/GettingStarted.TypicalSimpleApp/CoconaSample.GettingStarted.TypicalSimpleApp.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 enable diff --git a/samples/InAction.AppConfiguration/CoconaSample.InAction.AppConfiguration.csproj b/samples/InAction.AppConfiguration/CoconaSample.InAction.AppConfiguration.csproj index ea976e8..736dc52 100644 --- a/samples/InAction.AppConfiguration/CoconaSample.InAction.AppConfiguration.csproj +++ b/samples/InAction.AppConfiguration/CoconaSample.InAction.AppConfiguration.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 enable diff --git a/samples/InAction.CommandFilter/CoconaSample.InAction.CommandFilter.csproj b/samples/InAction.CommandFilter/CoconaSample.InAction.CommandFilter.csproj index 8b35a58..8d1e804 100644 --- a/samples/InAction.CommandFilter/CoconaSample.InAction.CommandFilter.csproj +++ b/samples/InAction.CommandFilter/CoconaSample.InAction.CommandFilter.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 enable diff --git a/samples/InAction.CommandOptionOverload/CoconaSample.InAction.CommandOptionOverload.csproj b/samples/InAction.CommandOptionOverload/CoconaSample.InAction.CommandOptionOverload.csproj index 8b35a58..8d1e804 100644 --- a/samples/InAction.CommandOptionOverload/CoconaSample.InAction.CommandOptionOverload.csproj +++ b/samples/InAction.CommandOptionOverload/CoconaSample.InAction.CommandOptionOverload.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 enable diff --git a/samples/InAction.CommandOptions/CoconaSample.InAction.CommandOptions.csproj b/samples/InAction.CommandOptions/CoconaSample.InAction.CommandOptions.csproj index 8b35a58..8d1e804 100644 --- a/samples/InAction.CommandOptions/CoconaSample.InAction.CommandOptions.csproj +++ b/samples/InAction.CommandOptions/CoconaSample.InAction.CommandOptions.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 enable diff --git a/samples/InAction.DependencyInjection/CoconaSample.InAction.DependencyInjection.csproj b/samples/InAction.DependencyInjection/CoconaSample.InAction.DependencyInjection.csproj index 8b35a58..8d1e804 100644 --- a/samples/InAction.DependencyInjection/CoconaSample.InAction.DependencyInjection.csproj +++ b/samples/InAction.DependencyInjection/CoconaSample.InAction.DependencyInjection.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 enable diff --git a/samples/InAction.ExitCode/CoconaSample.InAction.ExitCode.csproj b/samples/InAction.ExitCode/CoconaSample.InAction.ExitCode.csproj index 8b35a58..8d1e804 100644 --- a/samples/InAction.ExitCode/CoconaSample.InAction.ExitCode.csproj +++ b/samples/InAction.ExitCode/CoconaSample.InAction.ExitCode.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 enable diff --git a/samples/InAction.HandleShutdownSignal/CoconaSample.InAction.HandleShutdownSignal.csproj b/samples/InAction.HandleShutdownSignal/CoconaSample.InAction.HandleShutdownSignal.csproj index 8b35a58..8d1e804 100644 --- a/samples/InAction.HandleShutdownSignal/CoconaSample.InAction.HandleShutdownSignal.csproj +++ b/samples/InAction.HandleShutdownSignal/CoconaSample.InAction.HandleShutdownSignal.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 enable diff --git a/samples/InAction.ManyArguments/CoconaSample.InAction.ManyArguments.csproj b/samples/InAction.ManyArguments/CoconaSample.InAction.ManyArguments.csproj index 8b35a58..8d1e804 100644 --- a/samples/InAction.ManyArguments/CoconaSample.InAction.ManyArguments.csproj +++ b/samples/InAction.ManyArguments/CoconaSample.InAction.ManyArguments.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 enable diff --git a/samples/InAction.MultipleCommandTypes/CoconaSample.InAction.MultipleCommandTypes.csproj b/samples/InAction.MultipleCommandTypes/CoconaSample.InAction.MultipleCommandTypes.csproj index 8b35a58..8d1e804 100644 --- a/samples/InAction.MultipleCommandTypes/CoconaSample.InAction.MultipleCommandTypes.csproj +++ b/samples/InAction.MultipleCommandTypes/CoconaSample.InAction.MultipleCommandTypes.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 enable diff --git a/samples/InAction.ParameterSet/CoconaSample.InAction.ParameterSet.csproj b/samples/InAction.ParameterSet/CoconaSample.InAction.ParameterSet.csproj index 8b35a58..8d1e804 100644 --- a/samples/InAction.ParameterSet/CoconaSample.InAction.ParameterSet.csproj +++ b/samples/InAction.ParameterSet/CoconaSample.InAction.ParameterSet.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 enable diff --git a/samples/InAction.Validation/CoconaSample.InAction.Validation.csproj b/samples/InAction.Validation/CoconaSample.InAction.Validation.csproj index b2c77f9..fed6650 100644 --- a/samples/InAction.Validation/CoconaSample.InAction.Validation.csproj +++ b/samples/InAction.Validation/CoconaSample.InAction.Validation.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 enable diff --git a/samples/MinimalApi.InAction/CoconaSample.MinimalApi.InAction.csproj b/samples/MinimalApi.InAction/CoconaSample.MinimalApi.InAction.csproj index 441d04a..50852b3 100644 --- a/samples/MinimalApi.InAction/CoconaSample.MinimalApi.InAction.csproj +++ b/samples/MinimalApi.InAction/CoconaSample.MinimalApi.InAction.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 enable enable diff --git a/samples/MinimalApi.MultipleCommands/CoconaSample.MinimalApi.MultipleCommands.csproj b/samples/MinimalApi.MultipleCommands/CoconaSample.MinimalApi.MultipleCommands.csproj index 30ff60f..b567b99 100644 --- a/samples/MinimalApi.MultipleCommands/CoconaSample.MinimalApi.MultipleCommands.csproj +++ b/samples/MinimalApi.MultipleCommands/CoconaSample.MinimalApi.MultipleCommands.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 enable enable diff --git a/samples/MinimalApi.QuickStart/CoconaSample.MinimalApi.QuickStart.csproj b/samples/MinimalApi.QuickStart/CoconaSample.MinimalApi.QuickStart.csproj index 30ff60f..b567b99 100644 --- a/samples/MinimalApi.QuickStart/CoconaSample.MinimalApi.QuickStart.csproj +++ b/samples/MinimalApi.QuickStart/CoconaSample.MinimalApi.QuickStart.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 enable enable diff --git a/samples/MinimalApi.SubCommand/CoconaSample.MinimalApi.SubCommand.csproj b/samples/MinimalApi.SubCommand/CoconaSample.MinimalApi.SubCommand.csproj index 441d04a..50852b3 100644 --- a/samples/MinimalApi.SubCommand/CoconaSample.MinimalApi.SubCommand.csproj +++ b/samples/MinimalApi.SubCommand/CoconaSample.MinimalApi.SubCommand.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 enable enable diff --git a/src/Cocona.Core/Cocona.Core.csproj b/src/Cocona.Core/Cocona.Core.csproj index 9d8e1d4..92b1546 100644 --- a/src/Cocona.Core/Cocona.Core.csproj +++ b/src/Cocona.Core/Cocona.Core.csproj @@ -1,7 +1,7 @@  - net6.0;netstandard2.0;netstandard2.1 + net8.0;net6.0;netstandard2.0;netstandard2.1 Cocona enable enable @@ -11,15 +11,15 @@ - + - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Cocona.Lite/Cocona.Lite.csproj b/src/Cocona.Lite/Cocona.Lite.csproj index f7f689e..b9a8422 100644 --- a/src/Cocona.Lite/Cocona.Lite.csproj +++ b/src/Cocona.Lite/Cocona.Lite.csproj @@ -1,7 +1,7 @@  - net6.0;netstandard2.0;netstandard2.1 + net8.0;net6.0;netstandard2.0;netstandard2.1 Cocona enable enable @@ -13,7 +13,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Cocona/Builder/Internal/BootstrapHostBuilder.cs b/src/Cocona/Builder/Internal/BootstrapHostBuilder.cs index 3ffe256..7e00113 100644 --- a/src/Cocona/Builder/Internal/BootstrapHostBuilder.cs +++ b/src/Cocona/Builder/Internal/BootstrapHostBuilder.cs @@ -38,17 +38,11 @@ public IHost Build() action(hostConfiguration); } - var contentRootPath = ResolveContentRootPath(hostConfiguration[HostDefaults.ContentRootKey], AppContext.BaseDirectory); + var contentRootPath = ResolveContentRootPath(hostConfiguration[HostDefaults.ContentRootKey]!, AppContext.BaseDirectory); var hostBuilderContext = new HostBuilderContext(new Dictionary()) { Configuration = hostConfiguration, - HostingEnvironment = new HostEnvironment() - { - ApplicationName = hostConfiguration[HostDefaults.ApplicationKey], - EnvironmentName = hostConfiguration[HostDefaults.EnvironmentKey] ?? Environments.Production, - ContentRootPath = contentRootPath, - ContentRootFileProvider = new PhysicalFileProvider(contentRootPath), - }, + HostingEnvironment = new HostEnvironment(hostConfiguration[HostDefaults.ApplicationKey]!, contentRootPath, new PhysicalFileProvider(contentRootPath), hostConfiguration[HostDefaults.EnvironmentKey] ?? Environments.Production) }; configuration.SetBasePath(hostBuilderContext.HostingEnvironment.ContentRootPath); @@ -86,12 +80,20 @@ private string ResolveContentRootPath(string contentRootPath, string basePath) return Path.Combine(Path.GetFullPath(basePath), contentRootPath); } - class HostEnvironment : IHostEnvironment + sealed class HostEnvironment : IHostEnvironment { - public string? ApplicationName { get; set; } - public IFileProvider? ContentRootFileProvider { get; set; } - public string? ContentRootPath { get; set; } - public string? EnvironmentName { get; set; } + public HostEnvironment(string applicationName, string contentRootPath, IFileProvider contentRootFileProvider, string environmentName) + { + ApplicationName = applicationName; + ContentRootFileProvider = contentRootFileProvider; + ContentRootPath = contentRootPath; + EnvironmentName = environmentName; + } + + public string ApplicationName { get; set; } + public IFileProvider ContentRootFileProvider { get; set; } + public string ContentRootPath { get; set; } + public string EnvironmentName { get; set; } } public IHostBuilder ConfigureAppConfiguration(Action configureDelegate) diff --git a/src/Cocona/Builder/Internal/CoconaAppHostOptions.cs b/src/Cocona/Builder/Internal/CoconaAppHostOptions.cs index dae4c9e..4e73c63 100644 --- a/src/Cocona/Builder/Internal/CoconaAppHostOptions.cs +++ b/src/Cocona/Builder/Internal/CoconaAppHostOptions.cs @@ -1,6 +1,6 @@ namespace Cocona.Builder.Internal; -internal class CoconaAppHostOptions +internal sealed class CoconaAppHostOptions { public Action? ConfigureApplication { get; set; } } diff --git a/src/Cocona/Builder/Internal/ConfigureHostBuilder.cs b/src/Cocona/Builder/Internal/ConfigureHostBuilder.cs index c42962e..357e92d 100644 --- a/src/Cocona/Builder/Internal/ConfigureHostBuilder.cs +++ b/src/Cocona/Builder/Internal/ConfigureHostBuilder.cs @@ -4,7 +4,7 @@ namespace Cocona.Builder.Internal; -internal class ConfigureHostBuilder : IHostBuilder +internal sealed class ConfigureHostBuilder : IHostBuilder { private readonly List> _operations = new(); diff --git a/src/Cocona/Cocona.csproj b/src/Cocona/Cocona.csproj index 3f86159..4fed090 100644 --- a/src/Cocona/Cocona.csproj +++ b/src/Cocona/Cocona.csproj @@ -1,7 +1,7 @@  - net6.0;netstandard2.0;netstandard2.1 + net8.0;net6.0;netstandard2.0;netstandard2.1 true enable @@ -10,16 +10,16 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + diff --git a/test/Cocona.Lite.Test/Cocona.Lite.Test.csproj b/test/Cocona.Lite.Test/Cocona.Lite.Test.csproj index aa3f331..c718d68 100644 --- a/test/Cocona.Lite.Test/Cocona.Lite.Test.csproj +++ b/test/Cocona.Lite.Test/Cocona.Lite.Test.csproj @@ -7,7 +7,7 @@ $(NoWarn);1701;1702;CS1998 annotations enable - net6.0 + net8.0 Library @@ -28,11 +28,17 @@ - - - - - + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/test/Cocona.Test/Cocona.Test.csproj b/test/Cocona.Test/Cocona.Test.csproj index 792e375..e2e0dae 100644 --- a/test/Cocona.Test/Cocona.Test.csproj +++ b/test/Cocona.Test/Cocona.Test.csproj @@ -1,7 +1,7 @@  - net6.0;net7.0 + net6.0;net7.0;net8.0 false true ..\..\src\Cocona\StrongNameKey.snk @@ -13,11 +13,17 @@ - - - - - + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/test/Cocona.Test/Command/ParameterBinder/BindParameterTest.cs b/test/Cocona.Test/Command/ParameterBinder/BindParameterTest.cs index 22d7054..c7ab4cb 100644 --- a/test/Cocona.Test/Command/ParameterBinder/BindParameterTest.cs +++ b/test/Cocona.Test/Command/ParameterBinder/BindParameterTest.cs @@ -167,7 +167,7 @@ public void BindArguments_Array_First() var invokeArgs = CreateCoconaParameterBinder().Bind(commandDescriptor, commandOptions, commandArguments); invokeArgs.Should().NotBeNull(); invokeArgs.Should().HaveCount(3); - invokeArgs[0].Should().Equals(new[] { "argValue0", "argValue1", }); + invokeArgs[0].Should().BeEquivalentTo(new[] { "argValue0", "argValue1", }); invokeArgs[1].Should().Be("argValue2"); invokeArgs[2].Should().Be("argValue3"); } @@ -192,7 +192,7 @@ public void BindArguments_Array_Middle() invokeArgs.Should().NotBeNull(); invokeArgs.Should().HaveCount(3); invokeArgs[0].Should().Be("argValue0"); - invokeArgs[1].Should().Equals(new[] { "argValue1", "argValue2", }); + invokeArgs[1].Should().BeEquivalentTo(new[] { "argValue1", "argValue2", }); invokeArgs[2].Should().Be("argValue3"); } @@ -217,7 +217,7 @@ public void BindArguments_Array_Last() invokeArgs.Should().HaveCount(3); invokeArgs[0].Should().Be("argValue0"); invokeArgs[1].Should().Be("argValue1"); - invokeArgs[2].Should().Equals(new[] { "argValue2", "argValue3", }); + invokeArgs[2].Should().BeEquivalentTo(new[] { "argValue2", "argValue3", }); } [Fact] @@ -277,7 +277,7 @@ public void BindArguments_Array_One() var invokeArgs = CreateCoconaParameterBinder().Bind(commandDescriptor, commandOptions, commandArguments); invokeArgs.Should().NotBeNull(); invokeArgs.Should().HaveCount(1); - invokeArgs[0].Should().Equals(new string[] { "argValue0" }); + invokeArgs[0].Should().BeEquivalentTo(new string[] { "argValue0" }); } [Fact] @@ -343,7 +343,7 @@ public void BindArguments_Array_DefaultValue() var invokeArgs = CreateCoconaParameterBinder().Bind(commandDescriptor, commandOptions, commandArguments); invokeArgs.Should().NotBeNull(); invokeArgs.Should().HaveCount(3); - invokeArgs[0].Should().Equals(new[] { "argValue0", }); + invokeArgs[0].Should().BeEquivalentTo(new[] { "argValue0", }); invokeArgs[1].Should().Be("argValue1"); invokeArgs[2].Should().Be("argValue2"); } @@ -409,7 +409,7 @@ public void BindArguments_List() var invokeArgs = CreateCoconaParameterBinder().Bind(commandDescriptor, commandOptions, commandArguments); invokeArgs.Should().NotBeNull(); invokeArgs.Should().HaveCount(3); - invokeArgs[0].Should().Equals(new List() { "argValue0", "argValue1", }); + invokeArgs[0].Should().BeEquivalentTo(new List() { "argValue0", "argValue1", }); invokeArgs[1].Should().Be("argValue2"); invokeArgs[2].Should().Be("argValue3"); } @@ -864,4 +864,4 @@ public TestCommandParameterizedParameterSet(int option0, bool option1, [Argument Arg0 = arg0; } } -} \ No newline at end of file +} From 66af58479b0f91ee2f5a6edf892df8e7ef2a8e88 Mon Sep 17 00:00:00 2001 From: "Dominik.Kotecki" Date: Sat, 18 Nov 2023 16:39:45 +0100 Subject: [PATCH 2/3] fix --- .azure-pipelines/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/build.yml b/.azure-pipelines/build.yml index fdecf38..6e7582c 100644 --- a/.azure-pipelines/build.yml +++ b/.azure-pipelines/build.yml @@ -78,7 +78,7 @@ jobs: - task: UseDotNet@2 inputs: packageType: 'sdk' - version: 7.0.x + version: 8.0.x - script: dotnet restore displayName: dotnet restore From f0b9f60abdf14572ade2ee7890e35136ce8fa114 Mon Sep 17 00:00:00 2001 From: "Dominik.Kotecki" Date: Sat, 18 Nov 2023 16:56:41 +0100 Subject: [PATCH 3/3] remove dotnet 7 --- test/Cocona.Test/Cocona.Test.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Cocona.Test/Cocona.Test.csproj b/test/Cocona.Test/Cocona.Test.csproj index e2e0dae..3ba0caa 100644 --- a/test/Cocona.Test/Cocona.Test.csproj +++ b/test/Cocona.Test/Cocona.Test.csproj @@ -1,7 +1,7 @@  - net6.0;net7.0;net8.0 + net6.0;net8.0 false true ..\..\src\Cocona\StrongNameKey.snk