Skip to content

Commit

Permalink
Add support for .NET 8
Browse files Browse the repository at this point in the history
- Update to .NET 8 SDK.
- Add `net8.0` TFM.
- Bump packages to .NET 8 versions where relevant.
- Remove `Microsoft.CodeAnalysis.NetAnalyzers`.

Relates to #1141.
  • Loading branch information
martincostello committed Apr 18, 2023
1 parent a3b57f9 commit aa2788b
Show file tree
Hide file tree
Showing 14 changed files with 32 additions and 17 deletions.
5 changes: 4 additions & 1 deletion eng/Analyzers.targets
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project>
<ItemGroup Label="Analyzers" Condition="$(UseDefaultAnalyzers) == 'true'">
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" PrivateAssets="All" />
<PackageReference Include="SonarAnalyzer.CSharp" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" PrivateAssets="All" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
<AdditionalFiles Include="$(MsBuildThisFileDirectory)analyzers\Stylecop.json" Visible="false" />
Expand All @@ -13,5 +12,9 @@
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<AnalysisLevel>latest</AnalysisLevel>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<!--
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
-->
</PropertyGroup>
</Project>
4 changes: 2 additions & 2 deletions eng/stryker-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
"block",
"statement"
],
"target-framework": "net7.0",
"target-framework": "net8.0",
"thresholds": {
"high": 100,
"low": 100
}
}
}
}
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "7.0.203",
"version": "8.0.100-preview.3.23178.7",
"allowPrerelease": false,
"rollForward": "latestMajor"
}
Expand Down
4 changes: 4 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>

<PropertyGroup>
<NoWarn>NU5104;$(NoWarn)</NoWarn>
</PropertyGroup>

<ItemGroup>
<Using Include="System.Collections" />
<Using Include="System.Collections.Concurrent" />
Expand Down
12 changes: 10 additions & 2 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<PackageVersion Include="BenchmarkDotNet" Version="0.13.5" />
<PackageVersion Include="FluentAssertions" Version="6.10.0" />
<PackageVersion Include="GitHubActionsTestLogger" Version="2.0.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="7.0.1" />
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="7.0.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="7.0.0" />
Expand All @@ -22,6 +21,15 @@
<PackageVersion Include="xunit" Version="2.4.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.4.5" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework) == 'net8.0'">
<PackageVersion Include="Microsoft.Extensions.Options" Version="8.0.0-preview.3.23174.8" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0-preview.3.23174.8" />
<PackageVersion Update="Microsoft.Extensions.Caching.Memory" Version="8.0.0-preview.3.23174.8" />
<PackageVersion Update="Microsoft.Extensions.DependencyInjection" Version="8.0.0-preview.3.23174.8" />
<PackageVersion Update="Microsoft.Extensions.Logging" Version="8.0.0-preview.3.23174.8" />
<PackageVersion Update="System.Diagnostics.DiagnosticSource" Version="8.0.0-preview.3.23174.8" />
<PackageVersion Update="System.Threading.RateLimiting" Version="8.0.0-preview.3.23174.8" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework) == 'net7.0'">
<PackageVersion Include="Microsoft.Extensions.Options" Version="7.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
Expand All @@ -34,4 +42,4 @@
<PackageVersion Include="Microsoft.Extensions.Options" Version="2.2.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="2.2.0" />
</ItemGroup>
</Project>
</Project>
2 changes: 1 addition & 1 deletion src/Polly.Benchmarks/Polly.Benchmarks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<IsPackable>false</IsPackable>
<OutputType>Exe</OutputType>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Polly.Core.Benchmarks/Polly.Core.Benchmarks.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net7.0</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0</TargetFrameworks>
<RootNamespace>Polly</RootNamespace>
<ImplicitUsings>true</ImplicitUsings>
<ProjectType>Benchmark</ProjectType>
Expand Down
2 changes: 1 addition & 1 deletion src/Polly.Core.Tests/Polly.Core.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('Windows'))">$(TargetFrameworks);net481</TargetFrameworks>
<ProjectType>Test</ProjectType>
<UseDefaultAnalyzers>true</UseDefaultAnalyzers>
Expand Down
2 changes: 1 addition & 1 deletion src/Polly.Core/Polly.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net7.0;net6.0;netstandard2.0;net472;net462</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;net6.0;netstandard2.0;net472;net462</TargetFrameworks>
<AssemblyTitle>Polly.Core</AssemblyTitle>
<RootNamespace>Polly</RootNamespace>
<Nullable>enable</Nullable>
Expand Down
2 changes: 1 addition & 1 deletion src/Polly.Extensions.Tests/Polly.Extensions.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('Windows'))">$(TargetFrameworks);net481</TargetFrameworks>
<ProjectType>Test</ProjectType>
<UseDefaultAnalyzers>true</UseDefaultAnalyzers>
Expand Down
4 changes: 2 additions & 2 deletions src/Polly.Extensions/Polly.Extensions.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net7.0;net6.0;netstandard2.0;net472;net462</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;net6.0;netstandard2.0;net472;net462</TargetFrameworks>
<AssemblyTitle>Polly.Extensions</AssemblyTitle>
<RootNamespace>Polly.Extensions</RootNamespace>
<Nullable>enable</Nullable>
Expand All @@ -19,7 +19,7 @@
<ItemGroup>
<ProjectReference Include="..\Polly.Core\Polly.Core.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Options" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('Windows'))">$(TargetFrameworks);net481</TargetFrameworks>
<ProjectType>Test</ProjectType>
<UseDefaultAnalyzers>true</UseDefaultAnalyzers>
Expand Down
4 changes: 2 additions & 2 deletions src/Polly.RateLimiting/Polly.RateLimiting.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net7.0;net6.0;netstandard2.0;net472;net462</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;net6.0;netstandard2.0;net472;net462</TargetFrameworks>
<AssemblyTitle>Polly.RateLimiting</AssemblyTitle>
<RootNamespace>Polly.RateLimiting</RootNamespace>
<Nullable>enable</Nullable>
Expand All @@ -11,7 +11,7 @@
<MutationScore>100</MutationScore>
<LegacySupport>true</LegacySupport>
</PropertyGroup>

<ItemGroup>
<Using Include="Polly.Utils" />
<Using Remove="System.Net.Http" />
Expand Down
2 changes: 1 addition & 1 deletion src/Polly.Specs/Polly.Specs.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('Windows'))">$(TargetFrameworks);net481</TargetFrameworks>
<Nullable>enable</Nullable>
<ProjectType>Test</ProjectType>
Expand Down

0 comments on commit aa2788b

Please sign in to comment.