Skip to content

Commit

Permalink
Remove end of life .NET versions and add .NET 9.0 support (#177)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
MitchRazga and Mitch Razga authored Feb 6, 2025
1 parent 2f53fae commit c97c6b6
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 45 deletions.
11 changes: 1 addition & 10 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
3.1.x
6.0.x
7.0.x
8.0.x
9.0.x
- name: Build
Expand Down Expand Up @@ -56,15 +53,9 @@ jobs:
strategy:
matrix:
sdk:
- 6.0.x
- 7.0.x
- 8.0.x
- 9.0.x
include:
- sdk: 6.0.x
tfm: net6.0
- sdk: 7.0.x
tfm: net7.0
- sdk: 8.0.x
tfm: net8.0
- sdk: 9.0.x
Expand Down Expand Up @@ -104,7 +95,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
dotnet-version: 9.0.x
- name: Publish unity packages to npm
shell: pwsh
run: |
Expand Down
12 changes: 2 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Jab provides a [C# Source Generator](https://devblogs.microsoft.com/dotnet/intro
- Clean stack traces: <br> ![stacktrace](https://raw.githubusercontent.com/pakrym/jab/main/doc/stacktrace.png)
- Readable generated code: <br> ![generated code](https://raw.githubusercontent.com/pakrym/jab/main/doc/generatedcode.png)
- Registration validation. Container configuration issues become compiler errors: <br> ![generated code](https://raw.githubusercontent.com/pakrym/jab/main/doc/errors.png)
- Incremental generation, .NET 5/6/7/8 SDK support, .NET Standard 2.0 support, [Unity support](README.md#Unity-installation)
- Incremental generation, Modern .NET SDK support, .NET Standard 2.0 support, [Unity support](README.md#Unity-installation)

## Example

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

### Generic registration attributes

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

```xml
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net7.0</TargetFrameworks>
</PropertyGroup>
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.

</Project>

```

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

Expand Down
2 changes: 1 addition & 1 deletion src/Jab.FunctionalTests.Common/Jab.FunctionalTest.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>

<PropertyGroup>
<DefaultFunctionalTestTargetFrameworks>netcoreapp3.1;net6.0;net7.0;net8.0;net9.0;netstandard2.0</DefaultFunctionalTestTargetFrameworks>
<DefaultFunctionalTestTargetFrameworks>net8.0;net9.0;netstandard2.0</DefaultFunctionalTestTargetFrameworks>
<DefaultFunctionalTestTargetFrameworks Condition="$([MSBuild]::IsOSPlatform('Windows'))" >$(DefaultFunctionalTestTargetFrameworks);net472</DefaultFunctionalTestTargetFrameworks>
<FunctionalTestTargetFrameworks Condition="'$(FunctionalTestTargetFrameworks)' == ''">$(DefaultFunctionalTestTargetFrameworks)</FunctionalTestTargetFrameworks>
<IsPackable>false</IsPackable>
Expand Down
15 changes: 8 additions & 7 deletions src/Jab.FunctionalTests.Common/Jab.FunctionalTests.Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@
<Import Project="$(MSBuildThisFileDirectory)/Jab.FunctionalTest.props" />

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5" Condition="'$(TargetFramework)' != 'netstandard2.0'">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.1" Condition="'$(TargetFramework)' != 'netstandard2.0'">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="1.3.0">
<PackageReference Include="coverlet.collector" Version="6.0.4">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.XUnit" Version="1.1.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.XUnit" Version="1.1.2" />
<!-- Override transitive package version System.Formats.Asn1 to address vulnerability: https://github.com/advisories/GHSA-447r-wph3-92pm -->
<PackageReference Include="System.Formats.Asn1" Version="9.0.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.4.0" />

<ProjectReference Include="..\Jab.FunctionalTests.Module\Jab.FunctionalTests.Module.csproj" />
<ProjectReference Include="..\Jab.FunctionalTests.Module\Jab.FunctionalTests.Module.csproj" />
<Compile Include="$(MSBuildThisFileDirectory)\**\*.cs" />
</ItemGroup>

Expand Down
7 changes: 2 additions & 5 deletions src/Jab.FunctionalTests.MEDI/Jab.FunctionalTests.MEDI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
<ItemGroup>
<PackageReference Condition="'$(TargetFramework)' == 'net472'" Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="2.1.0"/>
<PackageReference Condition="'$(TargetFramework)' == 'netstandard2.0'" Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="2.1.0"/>
<PackageReference Condition="'$(TargetFramework)' == 'netcoreapp3.1'" Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.1.0"/>
<PackageReference Condition="'$(TargetFramework)' == 'net6.0'" Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0"/>
<PackageReference Condition="'$(TargetFramework)' == 'net7.0'" Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0"/>
<PackageReference Condition="'$(TargetFramework)' == 'net8.0'" Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0"/>
<PackageReference Condition="'$(TargetFramework)' == 'net9.0'" Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.0"/>
<PackageReference Condition="'$(TargetFramework)' == 'net8.0'" Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.2"/>
<PackageReference Condition="'$(TargetFramework)' == 'net9.0'" Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.1"/>
</ItemGroup>
</Project>
6 changes: 3 additions & 3 deletions src/Jab.Performance/Jab.Performance.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Jab" Version="0.10.2" PrivateAssets="all" />
<PackageReference Include="BenchmarkDotNet" Version="0.12.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.1" />
<PackageReference Include="BenchmarkDotNet" Version="0.14.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.1" />
</ItemGroup>

</Project>
14 changes: 8 additions & 6 deletions src/Jab.Tests/Jab.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
</PropertyGroup>

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

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

<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="1.3.0">
<PackageReference Include="coverlet.collector" Version="6.0.4">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.XUnit" Version="1.1.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.XUnit" Version="1.1.2" />
<!-- Override transitive package version System.Formats.Asn1 to address vulnerability: https://github.com/advisories/GHSA-447r-wph3-92pm -->
<PackageReference Include="System.Formats.Asn1" Version="9.0.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.4.0" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions src/Jab/Jab.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
Expand Down Expand Up @@ -38,7 +38,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
</ItemGroup>

<Import Project="Jab.Common.props" />
Expand Down
2 changes: 1 addition & 1 deletion src/samples/ConsoleSample/ConsoleSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down

0 comments on commit c97c6b6

Please sign in to comment.