Reputation: 187
The error description is as below:
Severity Code Description Project File Line Suppression State
Error CS0433 The type 'ServiceCollection' exists in both 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' and 'Microsoft.Extensions.DependencyInjection, Version=5.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60'
I am having this error suddenly, I had tried several steps but the error wont go off. Some steps that I had tried:
Someone know how to solve this issue?
Upvotes: 12
Views: 6884
Reputation: 149
Add this line to your project:
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
It helped me.
Upvotes: 14
Reputation: 46
The comment on the original post was really helpful
I had the same issue and managed to resolve it by targeting .NET 6.0
Probably best to ready ourselves to point all of our .NET 5.0 projects to .NET 6.0 anyway since .NET 5.0 is being deprecated
Upvotes: 3