[11.0.100-preview.5.26277.119] pomodoroflavors build failed with error CS0433: The type 'ServiceCollection' exists in both 'Microsoft.Extensions.DependencyInjection.Abstractions' and 'Microsoft.Extensions.DependencyInjection'
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
### Describe the bug
When retargeting pomodoroflavors to **.NET SDK 11.0.100-preview.5.26277.119**, the build fails with CS0433.
This issue was observed starting from **11.0.100-preview.4.26230.115**.
**Error details:**
```
error CS0433: The type 'ServiceCollection' exists in both
'Microsoft.Extensions.DependencyInjection.Abstractions, Version=11.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
and
'Microsoft.Extensions.DependencyInjection, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
```
**Could you please help confirm if this issue is by design and if it is related to the breaking change [[Breaking change]: .NET 11+ shared framework includes Microsoft.Extensions.* Abstractions/Options/Primitives packages · Issue #52865 · dotnet/docs](https://github.com/dotnet/docs/issues/52865)? Thanks.**
### Steps to reproduce
**The machine has dotnet-sdk-11.0.100-preview.5.26277.119 installed.**
1. Clone the pomodoroflavors source code from [appcompat-wx/pomodoroflavors at RetargetSource](https://github.com/appcompat-wx/pomodoroflavors/tree/RetargetSource) (the RetargetSource branch).
2. Open Command Prompt window and navigate to \pomodoroflavors\PomodoroDesktop\ResultProject folder.
3. Run "dotnet new globaljson" command.
4. Update the global.json to use the "11.0.100-preview.5.26277.119" sdk version:
```
{
"sdk": {
"version": "11.0.100-preview.5.26277.119"
}
}
```
5. Navigate to \pomodoroflavors\PomodoroDesktop\ResultProject\PomodoroDesktop folder.
6. Run "dotnet build" command.
### Expected behavior
Build successfully without errors.
### Actual behavior
Build failed with below error:
`error CS0433: The type 'ServiceCollection' exists in both 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=11.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' and 'Microsoft.Extensions.DependencyInjection, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'`
### Is this a regression?
Yes
1. Windows11 25H2 + Retarget to dotnet-sdk-11.0.100-preview.3.26207.106: Pass
2. Windows11 25H2 + Retarget to dotnet-sdk-11.0.100-preview.4.26230.115: Fail
3. Windows11 25H2 + Retarget to dotnet-sdk-11.0.100-preview.5.26277.119: Fail
4. Windows11 25H2 + Retarget to dotnet-sdk-11.0.100-preview.5.26279.113: Fail
### Are there any workarounds?
_No response_
### dotnet --info output
```console
dotnet --info
.NET SDK:
Version: 11.0.100-preview.5.26277.119
Commit: dccdbc8c75
Workload version: 11.0.100-manifests.d33cc748
MSBuild version: 18.8.0-preview-26277-119+dccdbc8c7
Runtime Environment:
OS Name: Windows
OS Version: 10.0.26200
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\11.0.100-preview.5.26277.119\
.NET workloads installed:
There are no installed workloads to display.
Configured to use workload sets when installing new manifests.
No workload sets are installed. Run "dotnet workload restore" to install a workload set.
Host:
Version: 11.0.0-preview.5.26277.119
Architecture: x64
Commit: dccdbc8c75
.NET SDKs installed:
11.0.100-preview.5.26277.119 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 11.0.0-preview.5.26277.119 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 11.0.0-preview.5.26277.119 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 11.0.0-preview.5.26277.119 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
```
### IDE version
_No response_
### Other details
**Application Name**: pomodoroflavors
**OS**: Windows 11 25H2
**CPU**: AMD64
**.NET Build Numbe**r: dotnet-sdk-11.0.100-preview.5.26277.119
**Devdiv bug link**: [https://devdiv.visualstudio.com/DevDiv/_workitems/edit/3010789](https://devdiv.visualstudio.com/DevDiv/_workitems/edit/3010789)
**Findings:**
We identified that this behavior is likely related to the following documented breaking change:
[[Breaking change]: .NET 11+ shared framework includes Microsoft.Extensions.* Abstractions/Options/Primitives packages · Issue #52865 · dotnet/docs](https://github.com/dotnet/docs/issues/52865)
This suggests that the conflict may be caused by duplicate type resolution between assemblies included in the shared framework and explicitly referenced package versions.
[@dotnet-actwx-bot](https://github.com/dotnet-actwx-bot) [@dotnet/compat](https://github.com/orgs/dotnet/teams/compat)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.