Skip to content

Commit c97c6b6

Browse files
MitchRazgaMitch Razga
and
Mitch Razga
authored
Remove end of life .NET versions and add .NET 9.0 support (#177)
* Remove unsupported .NET targets * Add .NET 9 support * Update dependency packages and address transitive dependencies with vulnerabilities * Update dependency packages --------- Co-authored-by: Mitch Razga <[email protected]>
1 parent 2f53fae commit c97c6b6

File tree

9 files changed

+28
-45
lines changed

9 files changed

+28
-45
lines changed

.github/workflows/dotnet.yml

+1-10
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ jobs:
2020
uses: actions/setup-dotnet@v4
2121
with:
2222
dotnet-version: |
23-
3.1.x
24-
6.0.x
25-
7.0.x
2623
8.0.x
2724
9.0.x
2825
- name: Build
@@ -56,15 +53,9 @@ jobs:
5653
strategy:
5754
matrix:
5855
sdk:
59-
- 6.0.x
60-
- 7.0.x
6156
- 8.0.x
6257
- 9.0.x
6358
include:
64-
- sdk: 6.0.x
65-
tfm: net6.0
66-
- sdk: 7.0.x
67-
tfm: net7.0
6859
- sdk: 8.0.x
6960
tfm: net8.0
7061
- sdk: 9.0.x
@@ -104,7 +95,7 @@ jobs:
10495
- name: Setup .NET
10596
uses: actions/setup-dotnet@v4
10697
with:
107-
dotnet-version: 6.0.x
98+
dotnet-version: 9.0.x
10899
- name: Publish unity packages to npm
109100
shell: pwsh
110101
run: |

README.md

+2-10
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Jab provides a [C# Source Generator](https://devblogs.microsoft.com/dotnet/intro
1111
- Clean stack traces: <br> ![stacktrace](https://raw.githubusercontent.com/pakrym/jab/main/doc/stacktrace.png)
1212
- Readable generated code: <br> ![generated code](https://raw.githubusercontent.com/pakrym/jab/main/doc/generatedcode.png)
1313
- Registration validation. Container configuration issues become compiler errors: <br> ![generated code](https://raw.githubusercontent.com/pakrym/jab/main/doc/errors.png)
14-
- Incremental generation, .NET 5/6/7/8 SDK support, .NET Standard 2.0 support, [Unity support](README.md#Unity-installation)
14+
- Incremental generation, Modern .NET SDK support, .NET Standard 2.0 support, [Unity support](README.md#Unity-installation)
1515

1616
## Example
1717

@@ -169,18 +169,10 @@ When the scope is disposed all `IDisposable` and `IAsyncDisposable` services tha
169169

170170
### Generic registration attributes
171171

172-
You can use generic attributes to register services if your project targets `net7.0` or `net6.0` and has `LangVersion` set to preview.
173172

174-
```xml
175-
<Project Sdk="Microsoft.NET.Sdk">
176-
177-
<PropertyGroup>
178-
<TargetFrameworks>net7.0</TargetFrameworks>
179-
</PropertyGroup>
173+
You can use generic attributes to register services if your project targets a framework compatible with C# 11 or greater. See [C# language versioning](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/language-versioning#defaults) for more details.
180174

181-
</Project>
182175

183-
```
184176

185177
Generic attributes allow declaration to be more compact by avoiding the `typeof` calls:
186178

src/Jab.FunctionalTests.Common/Jab.FunctionalTest.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
22

33
<PropertyGroup>
4-
<DefaultFunctionalTestTargetFrameworks>netcoreapp3.1;net6.0;net7.0;net8.0;net9.0;netstandard2.0</DefaultFunctionalTestTargetFrameworks>
4+
<DefaultFunctionalTestTargetFrameworks>net8.0;net9.0;netstandard2.0</DefaultFunctionalTestTargetFrameworks>
55
<DefaultFunctionalTestTargetFrameworks Condition="$([MSBuild]::IsOSPlatform('Windows'))" >$(DefaultFunctionalTestTargetFrameworks);net472</DefaultFunctionalTestTargetFrameworks>
66
<FunctionalTestTargetFrameworks Condition="'$(FunctionalTestTargetFrameworks)' == ''">$(DefaultFunctionalTestTargetFrameworks)</FunctionalTestTargetFrameworks>
77
<IsPackable>false</IsPackable>

src/Jab.FunctionalTests.Common/Jab.FunctionalTests.Common.props

+8-7
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,21 @@
33
<Import Project="$(MSBuildThisFileDirectory)/Jab.FunctionalTest.props" />
44

55
<ItemGroup>
6-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
7-
<PackageReference Include="xunit" Version="2.4.2" />
8-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5" Condition="'$(TargetFramework)' != 'netstandard2.0'">
6+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
7+
<PackageReference Include="xunit" Version="2.9.3" />
8+
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.1" Condition="'$(TargetFramework)' != 'netstandard2.0'">
99
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1010
<PrivateAssets>all</PrivateAssets>
1111
</PackageReference>
12-
<PackageReference Include="coverlet.collector" Version="1.3.0">
12+
<PackageReference Include="coverlet.collector" Version="6.0.4">
1313
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1414
<PrivateAssets>all</PrivateAssets>
1515
</PackageReference>
16-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.XUnit" Version="1.1.1" />
16+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.XUnit" Version="1.1.2" />
17+
<!-- Override transitive package version System.Formats.Asn1 to address vulnerability: https://github.com/advisories/GHSA-447r-wph3-92pm -->
18+
<PackageReference Include="System.Formats.Asn1" Version="9.0.1" />
1719
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.4.0" />
18-
19-
<ProjectReference Include="..\Jab.FunctionalTests.Module\Jab.FunctionalTests.Module.csproj" />
20+
<ProjectReference Include="..\Jab.FunctionalTests.Module\Jab.FunctionalTests.Module.csproj" />
2021
<Compile Include="$(MSBuildThisFileDirectory)\**\*.cs" />
2122
</ItemGroup>
2223

src/Jab.FunctionalTests.MEDI/Jab.FunctionalTests.MEDI.csproj

+2-5
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@
99
<ItemGroup>
1010
<PackageReference Condition="'$(TargetFramework)' == 'net472'" Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="2.1.0"/>
1111
<PackageReference Condition="'$(TargetFramework)' == 'netstandard2.0'" Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="2.1.0"/>
12-
<PackageReference Condition="'$(TargetFramework)' == 'netcoreapp3.1'" Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.1.0"/>
13-
<PackageReference Condition="'$(TargetFramework)' == 'net6.0'" Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0"/>
14-
<PackageReference Condition="'$(TargetFramework)' == 'net7.0'" Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0"/>
15-
<PackageReference Condition="'$(TargetFramework)' == 'net8.0'" Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0"/>
16-
<PackageReference Condition="'$(TargetFramework)' == 'net9.0'" Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.0"/>
12+
<PackageReference Condition="'$(TargetFramework)' == 'net8.0'" Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.2"/>
13+
<PackageReference Condition="'$(TargetFramework)' == 'net9.0'" Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.1"/>
1714
</ItemGroup>
1815
</Project>

src/Jab.Performance/Jab.Performance.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net8.0</TargetFramework>
5+
<TargetFramework>net9.0</TargetFramework>
66
<IsPackable>false</IsPackable>
77
</PropertyGroup>
88

99
<ItemGroup>
1010
<PackageReference Include="Jab" Version="0.10.2" PrivateAssets="all" />
11-
<PackageReference Include="BenchmarkDotNet" Version="0.12.1" />
12-
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.1" />
11+
<PackageReference Include="BenchmarkDotNet" Version="0.14.0" />
12+
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.1" />
1313
</ItemGroup>
1414

1515
</Project>

src/Jab.Tests/Jab.Tests.csproj

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netcoreapp3.1;net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
4+
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
55
</PropertyGroup>
66

77
<ItemGroup>
88
<ProjectReference Include="..\Jab\Jab.csproj" />
99

1010
<Content Include="..\Jab\Attributes.cs" CopyToOutputDirectory="PreserveNewest" />
1111

12-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
13-
<PackageReference Include="xunit" Version="2.4.2" />
14-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
12+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
13+
<PackageReference Include="xunit" Version="2.9.3" />
14+
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.1">
1515
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1616
<PrivateAssets>all</PrivateAssets>
1717
</PackageReference>
18-
<PackageReference Include="coverlet.collector" Version="1.3.0">
18+
<PackageReference Include="coverlet.collector" Version="6.0.4">
1919
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2020
<PrivateAssets>all</PrivateAssets>
2121
</PackageReference>
22-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.XUnit" Version="1.1.1" />
22+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.XUnit" Version="1.1.2" />
23+
<!-- Override transitive package version System.Formats.Asn1 to address vulnerability: https://github.com/advisories/GHSA-447r-wph3-92pm -->
24+
<PackageReference Include="System.Formats.Asn1" Version="9.0.1" />
2325
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.4.0" />
2426
</ItemGroup>
2527
</Project>

src/Jab/Jab.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<TargetFramework>netstandard2.0</TargetFramework>
@@ -38,7 +38,7 @@
3838
</ItemGroup>
3939

4040
<ItemGroup>
41-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
41+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
4242
</ItemGroup>
4343

4444
<Import Project="Jab.Common.props" />

src/samples/ConsoleSample/ConsoleSample.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net6.0</TargetFramework>
5+
<TargetFramework>net9.0</TargetFramework>
66
<IsPackable>false</IsPackable>
77
</PropertyGroup>
88

0 commit comments

Comments
 (0)