Skip to content

Commit

Permalink
Add net8.0 target and update packages
Browse files Browse the repository at this point in the history
  • Loading branch information
CZEMacLeod committed Aug 22, 2024
1 parent 8e67f8e commit 73d4f0d
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 37 deletions.
1 change: 1 addition & 0 deletions C3D.Extensions.Logging.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Build.CopyOnWrite" Version="1.0.302" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="Microsoft.Build.CopyOnWrite" Version="1.0.315" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
</ItemGroup>
</Project>
14 changes: 14 additions & 0 deletions build/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 1 addition & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net462;netstandard2.0;netstandard2.1;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net6.0;net462;netstandard2.0;netstandard2.1;net7.0;net8.0</TargetFrameworks>
<Nullable>enable</Nullable>
<LangVersion>10.0</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
Expand All @@ -20,16 +20,13 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="xunit.abstractions" Version="2.0.3" />
<PackageReference Include="xunit.extensibility.execution" Version="2.5.0" />
<PackageReference Include="xunit.extensibility.execution" Version="2.9.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="6.0.0" />
<PackageReference Include="System.Collections.Immutable" Version="6.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)'=='net7.0'">
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
<PackageReference Include="System.Collections.Immutable" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
16 changes: 2 additions & 14 deletions src/C3D/Extensions/Logging/Xunit/Loggers/XunitLoggerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,21 +79,9 @@ protected string BuildMessageText<TState>(LogLevel logLevel, TState state, Excep
return message;
}

#region "Scope"
#if NET7_0_OR_GREATER
public virtual IDisposable? BeginScope<TState>(TState state) where TState : notnull => null;
#else
private class NullScope : IDisposable
{
public void Dispose()
{
}
}
public virtual IDisposable BeginScope<TState>(TState state) => new NullScope();
#endif
#endregion
public virtual IDisposable? BeginScope<TState>(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<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter);

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

<PropertyGroup>
<TargetFrameworks>net6.0;net48;net7.0</TargetFrameworks>
<TargetFrameworks>net6.0;net48;net7.0;net8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>10.0</LangVersion>
Expand All @@ -18,16 +18,16 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
<PackageReference Include="System.Text.Json" Version="8.0.4" />

<PackageReference Include="System.Collections.Immutable" Version="6.0.0" />
<PackageReference Include="System.Collections.Immutable" Version="8.0.0" />

<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="$(PUTDirectory)C3D.Extensions.Logging.Xunit.csproj" />
</ItemGroup>

</Project>
8 changes: 4 additions & 4 deletions test/Directory.Build.Targets
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.targets', '$(MSBuildThisFileDirectory)../'))" />

<ItemGroup Label="Testing" Condition="'$(IsTestProject)'=='true'">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.0" />
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.0">
<PackageReference Include="coverlet.collector" Version="6.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down

0 comments on commit 73d4f0d

Please sign in to comment.