skip to Main Content

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


  1. UPDATE:

    Potential issue might be referenced project is using preview version of package version 8.0.0-* and other project is referencing stable version 7.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:

    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
    

    Add or edit binding redirect:

    <dependentAssembly>
      <assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions"
        publicKeyToken="adb9793829ddae60"
        culture="en-us" />
      <bindingRedirect oldVersion="7.0.0.0" newVersion="8.0.0.0" />
    </dependentAssembly>
    

    More info:

    Redirecting assembly versions

    Login or Signup to reply.
  2. While migrating from .NET framework to .NET 6 core, you have to keep following thing in mind

    • reference library in your project is compliant to which .NET standard/netstandard ( .NET standard 1.x, or 2.0 or 2.1 )?
    • By default .NET 6.0 core set to net standard 2.1 and your .net framework may be net standard 2.0 or earlier one

    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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search