Skip to content

Commit e70f950

Browse files
CopilotArash-Sabet
andcommitted
Upgrade to .NET SDK 10.0 (net10.0) - drop backward compatibility
Co-authored-by: Arash-Sabet <26050123+Arash-Sabet@users.noreply.github.com>
1 parent 180fe48 commit e70f950

File tree

8 files changed

+69
-33
lines changed

8 files changed

+69
-33
lines changed

CHANGELOG.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [10.0.0] - 2025-11-15
9+
10+
### Breaking Changes
11+
- **Upgraded to .NET 10.0** - This version targets `net10.0` exclusively
12+
- **Dropped support for all previous .NET versions** - .NET 9.0, 8.0, and earlier are no longer supported
13+
- Users must upgrade to .NET 10.0 SDK to use this version
14+
15+
### Changed
16+
- Updated all Microsoft.Extensions.* packages from 9.0.10 to 10.0.0
17+
- Updated xUnit packages from 3.1.0 to 3.2.0
18+
- Updated Microsoft.NET.Test.Sdk from 18.0.0 to 18.0.1
19+
- Updated Azure DevOps build pipelines to use .NET 10.0.100 SDK
20+
21+
### Fixed
22+
- Fixed lambda parameter naming conflict with C# `scoped` keyword in example tests
23+
24+
### Migration Guide
25+
To migrate from version 9.x to 10.0.0:
26+
1. Install .NET 10.0 SDK on your development machine
27+
2. Update your project's `TargetFramework` to `net10.0`
28+
3. Update package reference to version 10.0.0 or later:
29+
```xml
30+
<PackageReference Include="Xunit.Microsoft.DependencyInjection" Version="10.0.0" />
31+
```
32+
4. Rebuild and test your project
33+
34+
## [9.2.2] - Previous Release
35+
- See git history for changes prior to version 10.0.0

Directory.Packages.props

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@
55
</PropertyGroup>
66
<ItemGroup>
77
<!-- Microsoft.Extensions packages (core dependencies) -->
8-
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.10" />
9-
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.10" />
10-
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="9.0.10" />
11-
<PackageVersion Include="Microsoft.Extensions.Options" Version="9.0.10" />
12-
<PackageVersion Include="Microsoft.Extensions.Configuration.Binder" Version="9.0.10" />
13-
<PackageVersion Include="Microsoft.Extensions.Configuration.FileExtensions" Version="9.0.10" />
14-
<PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="9.0.10" />
15-
<PackageVersion Include="Microsoft.Extensions.Logging" Version="9.0.10" />
16-
<PackageVersion Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="9.0.10" />
17-
<PackageVersion Include="Microsoft.Extensions.Configuration.UserSecrets" Version="9.0.10" />
8+
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="10.0.0" />
9+
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.0" />
10+
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="10.0.0" />
11+
<PackageVersion Include="Microsoft.Extensions.Options" Version="10.0.0" />
12+
<PackageVersion Include="Microsoft.Extensions.Configuration.Binder" Version="10.0.0" />
13+
<PackageVersion Include="Microsoft.Extensions.Configuration.FileExtensions" Version="10.0.0" />
14+
<PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="10.0.0" />
15+
<PackageVersion Include="Microsoft.Extensions.Logging" Version="10.0.0" />
16+
<PackageVersion Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="10.0.0" />
17+
<PackageVersion Include="Microsoft.Extensions.Configuration.UserSecrets" Version="10.0.0" />
1818
<!-- xUnit packages -->
19-
<PackageVersion Include="xunit.v3.extensibility.core" Version="3.1.0" />
20-
<PackageVersion Include="xunit.v3" Version="3.1.0" />
19+
<PackageVersion Include="xunit.v3.extensibility.core" Version="3.2.0" />
20+
<PackageVersion Include="xunit.v3" Version="3.2.0" />
2121
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" />
2222
<!-- Development and build tools -->
2323
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
24-
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
24+
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
2525
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
2626
</ItemGroup>
2727
</Project>

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
![Nuget](https://img.shields.io/nuget/v/Xunit.Microsoft.DependencyInjection)
33
![Nuget](https://img.shields.io/nuget/dt/Xunit.Microsoft.DependencyInjection)
44

5-
# Xunit Dependency Injection framework - .NET 9.0
5+
# Xunit Dependency Injection framework - .NET 10.0
66

77
Xunit does not support any built-in dependency injection features, therefore developers have to come up with a solution to recruit their favourite dependency injection framework in their tests.
88

@@ -15,7 +15,7 @@ This library brings **Microsoft's dependency injection container** to Xunit by l
1515
## ✨ Key Features
1616

1717
- 🎯 **Multiple injection patterns** - Choose the approach that fits your team's style
18-
- 🔑 **Keyed services support** - Full .NET 9.0 keyed services integration
18+
- 🔑 **Keyed services support** - Full .NET 10.0 keyed services integration
1919
- ⚙️ **Configuration integration** - Support for `appsettings.json`, user secrets, and environment variables
2020
- 🧪 **Service lifetime management** - Transient, Scoped, and Singleton services work as expected
2121
- 📦 **Microsoft.Extensions ecosystem** - Built on the same DI container used by ASP.NET Core
@@ -26,21 +26,22 @@ This library brings **Microsoft's dependency injection container** to Xunit by l
2626

2727
* For **xUnit** packages use Xunit.Microsoft.DependencyInjection versions **up to** 9.0.5
2828
* For **xUnit.v3** packages use Xunit.Microsoft.DependencyInjection versions **from** 9.1.0
29+
* For **.NET 10.0** use Xunit.Microsoft.DependencyInjection version **10.0.0 or later**
2930

3031
Also please check the [migration guide](https://xunit.net/docs/getting-started/v3/migration) from xUnit for test authors.
3132

3233
### Example on how to reference xunit.v3
3334

3435
```xml
35-
<PackageReference Include="xunit.v3" Version="3.1.0" />
36+
<PackageReference Include="xunit.v3" Version="3.2.0" />
3637
```
3738

3839
## Getting started
3940

4041
### Prerequisites
4142

4243
Before you begin, ensure you have:
43-
- **.NET 9.0 SDK** installed on your development machine
44+
- **.NET 10.0 SDK** installed on your development machine
4445
- **Visual Studio 2022** or **Visual Studio Code** with C# extension
4546
- Basic understanding of dependency injection concepts
4647
- Familiarity with xUnit testing framework

azure-pipeline-PR.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
variables:
2-
Major: 9
2+
Major: 10
33
Minor: 0
44
Patch: 0
55
BuildConfiguration: Release
@@ -14,10 +14,10 @@ pool:
1414
steps:
1515
- script: echo Build Number $(name)
1616
- task: UseDotNet@2
17-
displayName: 'Use .NET 9.0 sdk'
17+
displayName: 'Use .NET 10.0 sdk'
1818
inputs:
1919
packageType: sdk
20-
version: 9.0.306
20+
version: 10.0.100
2121
installationPath: $(Agent.ToolsDirectory)/dotnet
2222
- script: echo Started restoring the source code
2323
- task: DotNetCoreCLI@2

azure-pipelines.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
variables:
2-
Major: 9
3-
Minor: 2
4-
Revision: 2
2+
Major: 10
3+
Minor: 0
4+
Revision: 0
55
BuildConfiguration: Release
66

77
name: $(Major).$(Minor).$(Revision)
@@ -22,10 +22,10 @@ pool:
2222
steps:
2323
- script: echo Build Number $(name)
2424
- task: UseDotNet@2
25-
displayName: 'Use .NET 9.0 sdk'
25+
displayName: 'Use .NET 10.0 sdk'
2626
inputs:
2727
packageType: sdk
28-
version: 9.0.306
28+
version: 10.0.100
2929
installationPath: $(Agent.ToolsDirectory)/dotnet
3030
- script: echo Started restoring the source code
3131
- task: DotNetCoreCLI@2

examples/Xunit.Microsoft.DependencyInjection.ExampleTests/AdvancedDependencyInjectionTests.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,12 @@ public void TestComplexFuncPatternWithMultipleServices()
177177
{
178178
// Arrange - Create a complex function that uses multiple services
179179
Func<IScopedService, ISingletonService, ICalculator, string> complexOperation =
180-
(scoped, singleton, calc) =>
180+
(scopedSvc, singletonSvc, calc) =>
181181
{
182-
scoped.Increment();
183-
singleton.IncrementGlobal();
184-
return $"Scoped: {scoped.InstanceId}, Singleton: {singleton.InstanceId}, " +
185-
$"ScopedCounter: {scoped.Counter}, GlobalCounter: {singleton.GlobalCounter}";
182+
scopedSvc.Increment();
183+
singletonSvc.IncrementGlobal();
184+
return $"Scoped: {scopedSvc.InstanceId}, Singleton: {singletonSvc.InstanceId}, " +
185+
$"ScopedCounter: {scopedSvc.Counter}, GlobalCounter: {singletonSvc.GlobalCounter}";
186186
};
187187

188188
// Act - Execute complex operation

examples/Xunit.Microsoft.DependencyInjection.ExampleTests/Xunit.Microsoft.DependencyInjection.ExampleTests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net9.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
<LangVersion>latest</LangVersion>
66
<IsPackable>false</IsPackable>
77
<Nullable>enable</Nullable>

src/Xunit.Microsoft.DependencyInjection.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>net9.0</TargetFramework>
3+
<TargetFramework>net10.0</TargetFramework>
44
<LangVersion>latest</LangVersion>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77

88
<!-- Version configuration - can be overridden by build system -->
9-
<Version Condition="'$(Version)' == ''">9.2.2</Version>
9+
<Version Condition="'$(Version)' == ''">10.0.0</Version>
1010

1111
<!-- NuGet Package Properties -->
1212
<PackageId>Xunit.Microsoft.DependencyInjection</PackageId>

0 commit comments

Comments
 (0)