简体   繁体   中英

No way to resolve conflict between - Warning

I am given such a warning during visual studio building

7>  No way to resolve conflict between "Microsoft.Extensions.DependencyInjection, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" and "Microsoft.Extensions.DependencyInjection, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60". Choosing "Microsoft.Extensions.DependencyInjection, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" arbitrarily.

In the solution I have several projects. How can I know / find where the compiler's confusion comes from? I was looking everywhere in the solution and I see no assembly in any project where can be used version 2.0.0.0?

Yes. This may be caused the two nuget package's dependencies which contain the same dependency Microsoft.Extensions.DependencyInjection but different versions. Or it is the project reference's dll.

Like this:

在此处输入图像描述

One way is to install Microsoft.Extensions.DependencyInjection nuget package version 3.0.0 .

Or add bindingRedirect under xxx.config file:

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <assemblyIdentity name="Microsoft.Extensions.DependencyInjection" publicKeyToken="xxx" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
        </dependentAssembly>
    </assemblyBinding>
  </runtime>

2) or just find the issue nuget and then update the its version which uses Microsoft.Extensions.DependencyInjection 3.0.0 dependencies.

3) Or you could use PackageReference nuget management format . This is a new nuget management format. Right-click on the packages.config file--> Migrate packages.config into PackageReference .

Besides , if the issue still persists, you could share the packages.config with us to help us troubleshoot the issue in our side.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM