I’m facing an issue in my C# project where I’m getting the following error message:
Severity Code Description Project File Line Suppression State Priority
Error CS1705 Assembly ‘Application’ with identity ‘Application, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’ uses ‘Microsoft.Extensions.DependencyInjection.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60’ which has a higher version than referenced assembly ‘Microsoft.Extensions.DependencyInjection.Abstractions’ with identity ‘Microsoft.Extensions.DependencyInjection.Abstractions, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60’ AdditionnalDataManagerAPI C:Usersala.bachhambasourcereposAdditionnalDataManagerAPICSc
I’m using the ‘AdditionnalDataManagerAPI’ project, and it seems to be related to a version conflict with ‘Microsoft.Extensions.DependencyInjection.Abstractions’. How can I resolve this error and make sure the project uses the correct version of the assembly?
I checked my project’s references to ensure that ‘Microsoft.Extensions.DependencyInjection.Abstractions’ is correctly referenced.
I attempted to update the reference to ‘Microsoft.Extensions.DependencyInjection.Abstractions’ to the latest version, but it didn’t resolve the issue.
I searched online for solutions and documentation related to ‘CS1705 Error’ and version conflicts but couldn’t find a solution that worked for my specific case.
2
Answers
UPDATE:
Potential issue might be referenced project is using preview version of package version
8.0.0-*
and other project is referencing stable version7.0.0
as latest package. Updating to preview packages should resolve the issue.Microsoft.Extensions.DependencyInjection.Abstractions – Version History
INITIAL RESPONSE:
You can enable auto binding redirect or add/edit redirect in csproj file.
Enabling auto binding redirect:
Add or edit binding redirect:
More info:
Redirecting assembly versions
While migrating from .NET framework to .NET 6 core, you have to keep following thing in mind
Hence if you re-target a project to a different version of .NET, your references may not resolve properly in some cases. Explicit fully qualified references to assemblies often cause this issue, but you can resolve it by removing the references that don’t resolve and then adding them back to the project.
For more details follow below article and remove your reference (in your case "Microsoft.Extensions.DependencyInjection.Abstractions") and then reference again.
Framework Retargeting