From 73d4f0d79c7539c3645c358284edf22a8ee81597 Mon Sep 17 00:00:00 2001 From: "Cynthia Z E MacLeod (C3D)" Date: Thu, 22 Aug 2024 15:13:23 +0100 Subject: [PATCH] Add net8.0 target and update packages --- C3D.Extensions.Logging.sln | 1 + Directory.Build.props | 4 ++-- build/azure-pipelines.yml | 14 ++++++++++++++ global.json | 3 +-- .../Xunit/C3D.Extensions.Logging.Xunit.csproj | 15 ++++++--------- .../Logging/Xunit/Loggers/XunitLoggerBase.cs | 16 ++-------------- .../C3D.Extensions.Logging.Xunit.Tests.csproj | 12 ++++++------ test/Directory.Build.Targets | 8 ++++---- 8 files changed, 36 insertions(+), 37 deletions(-) diff --git a/C3D.Extensions.Logging.sln b/C3D.Extensions.Logging.sln index 1082a28..ee0b62a 100644 --- a/C3D.Extensions.Logging.sln +++ b/C3D.Extensions.Logging.sln @@ -9,6 +9,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{B41F4209 ProjectSection(SolutionItems) = preProject Directory.Build.props = Directory.Build.props Directory.Build.targets = Directory.Build.targets + global.json = global.json build\Test.snk = build\Test.snk EndProjectSection EndProject diff --git a/Directory.Build.props b/Directory.Build.props index f4d2dbb..a53e306 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -5,7 +5,7 @@ - - + + \ No newline at end of file diff --git a/build/azure-pipelines.yml b/build/azure-pipelines.yml index 755a500..c009ae5 100644 --- a/build/azure-pipelines.yml +++ b/build/azure-pipelines.yml @@ -113,6 +113,20 @@ steps: useGlobalJson: true installationPath: $(Agent.ToolsDirectory)/dotnet +- task: UseDotNet@2 + displayName: 'Use .NET Runtime 6.0.x' + inputs: + packageType: 'runtime' + version: "6.0.x" + installationPath: $(Agent.ToolsDirectory)/dotnet + +- task: UseDotNet@2 + displayName: 'Use .NET Runtime 7.0.x' + inputs: + packageType: 'runtime' + version: "7.0.x" + installationPath: $(Agent.ToolsDirectory)/dotnet + # Install the code signing tool - task: DotNetCoreCLI@2 inputs: diff --git a/global.json b/global.json index 37d49dd..1f1be53 100644 --- a/global.json +++ b/global.json @@ -1,10 +1,9 @@ { "sdk": { - "version": "6.0.100", + "version": "8.0.400", "rollForward": "latestMajor", "allowPrerelease": true }, "msbuild-sdks": { - "Microsoft.Build.NoTargets": "2.0.1" } } diff --git a/src/C3D/Extensions/Logging/Xunit/C3D.Extensions.Logging.Xunit.csproj b/src/C3D/Extensions/Logging/Xunit/C3D.Extensions.Logging.Xunit.csproj index a08fade..5ba848f 100644 --- a/src/C3D/Extensions/Logging/Xunit/C3D.Extensions.Logging.Xunit.csproj +++ b/src/C3D/Extensions/Logging/Xunit/C3D.Extensions.Logging.Xunit.csproj @@ -1,7 +1,7 @@  - net462;netstandard2.0;netstandard2.1;net6.0;net7.0 + net6.0;net462;netstandard2.0;netstandard2.1;net7.0;net8.0 enable 10.0 enable @@ -20,16 +20,13 @@ runtime; build; native; contentfiles; analyzers - + - - - - - - - + + + + diff --git a/src/C3D/Extensions/Logging/Xunit/Loggers/XunitLoggerBase.cs b/src/C3D/Extensions/Logging/Xunit/Loggers/XunitLoggerBase.cs index f68ee8a..ddcaba0 100644 --- a/src/C3D/Extensions/Logging/Xunit/Loggers/XunitLoggerBase.cs +++ b/src/C3D/Extensions/Logging/Xunit/Loggers/XunitLoggerBase.cs @@ -79,21 +79,9 @@ protected string BuildMessageText(LogLevel logLevel, TState state, Excep return message; } - #region "Scope" -#if NET7_0_OR_GREATER -public virtual IDisposable? BeginScope(TState state) where TState : notnull => null; -#else - private class NullScope : IDisposable - { - public void Dispose() - { - } - } - public virtual IDisposable BeginScope(TState state) => new NullScope(); -#endif -#endregion + public virtual IDisposable? BeginScope(TState state) + where TState : notnull => Microsoft.Extensions.Logging.Abstractions.NullLogger.Instance.BeginScope(state); public virtual bool IsEnabled(LogLevel logLevel) => logLevel >= options().MinLevel; public abstract void Log(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func formatter); - } diff --git a/test/C3D/Extensions/Logging/Xunit/Test/C3D.Extensions.Logging.Xunit.Tests.csproj b/test/C3D/Extensions/Logging/Xunit/Test/C3D.Extensions.Logging.Xunit.Tests.csproj index 433706a..8a80fa3 100644 --- a/test/C3D/Extensions/Logging/Xunit/Test/C3D.Extensions.Logging.Xunit.Tests.csproj +++ b/test/C3D/Extensions/Logging/Xunit/Test/C3D.Extensions.Logging.Xunit.Tests.csproj @@ -1,7 +1,7 @@  - net6.0;net48;net7.0 + net6.0;net48;net7.0;net8.0 enable enable 10.0 @@ -18,16 +18,16 @@ - - + + + - + - + - diff --git a/test/Directory.Build.Targets b/test/Directory.Build.Targets index f7534df..a76a70e 100644 --- a/test/Directory.Build.Targets +++ b/test/Directory.Build.Targets @@ -2,13 +2,13 @@ - - - + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all