Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the dreaded "MSB3277: warning MSB3277: Found conflicts between different versions of the same dependent assembly that could not be resolved. " #1712

Closed
davkean opened this issue Feb 16, 2017 · 4 comments
Labels

Comments

@davkean
Copy link
Member

davkean commented Feb 16, 2017

This error message has been the bane of .NET developers for years. Having worked on assembly resolution for ~6 years in the BCL team, I've diagnosed so many of these warnings for customers, and there's three issues that I see with it:

  1. Developers don't know what this message means.

  2. Developers once they know what it means, don't know how to fix it.

  3. The warning is not actionable without building again with diagnostic build (if you can figure out how to do that). Even then you need to search for the issue in the log, and find the relevant portions.

Here's a typical log:

 There was a conflict between "Microsoft.Extensions.DependencyModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" and "Microsoft.Extensions.DependencyModel, Version=1.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60".
            "Microsoft.Extensions.DependencyModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" was chosen because it was primary and "Microsoft.Extensions.DependencyModel, Version=1.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" was not.
            References which depend on "Microsoft.Extensions.DependencyModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" [C:\Users\James\.nuget\packages\microsoft.extensions.dependencymodel\1.0.0\lib\netstandard1.6\Microsoft.Extensions.DependencyModel.dll].
                C:\Users\James\.nuget\packages\microsoft.extensions.dependencymodel\1.0.0\lib\netstandard1.6\Microsoft.Extensions.DependencyModel.dll
                  Project file item includes which caused reference "C:\Users\James\.nuget\packages\microsoft.extensions.dependencymodel\1.0.0\lib\netstandard1.6\Microsoft.Extensions.DependencyModel.dll".
                    C:\Users\James\.nuget\packages\microsoft.extensions.dependencymodel\1.0.0\lib\netstandard1.6\Microsoft.Extensions.DependencyModel.dll
            References which depend on "Microsoft.Extensions.DependencyModel, Version=1.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" [].
                C:\Users\James\.nuget\packages\microsoft.testplatform.testhost\15.0.0-preview-20170210-02\lib\netstandard1.5\Microsoft.TestPlatform.CrossPlatEngine.dll
                  Project file item includes which caused reference "C:\Users\James\.nuget\packages\microsoft.testplatform.testhost\15.0.0-preview-20170210-02\lib\netstandard1.5\Microsoft.TestPlatform.CrossPlatEngine.dll".
                    C:\Users\James\.nuget\packages\microsoft.testplatform.testhost\15.0.0-preview-20170210-02\lib\netstandard1.5\Microsoft.TestPlatform.CrossPlatEngine.dll
                    C:\Users\James\.nuget\packages\microsoft.testplatform.testhost\15.0.0-preview-20170210-02\lib\netstandard1.5\testhost.dll
       C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1956,5): warning MSB3277: Found conflicts between different versions of the same dependent assembly that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed.

Note the warning states:

warning MSB3277: Found conflicts between different versions of the same dependent assembly that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed.

But really the relevant portion is 1#:

 There was a conflict between "Microsoft.Extensions.DependencyModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" and "Microsoft.Extensions.DependencyModel, Version=1.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60".

and 2#

    References which depend on "Microsoft.Extensions.DependencyModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" [C:\Users\James\.nuget\packages\microsoft.extensions.dependencymodel\1.0.0\lib\netstandard1.6\Microsoft.Extensions.DependencyModel.dll].
                C:\Users\James\.nuget\packages\microsoft.extensions.dependencymodel\1.0.0\lib\netstandard1.6\Microsoft.Extensions.DependencyModel.dll
                  Project file item includes which caused reference "C:\Users\James\.nuget\packages\microsoft.extensions.dependencymodel\1.0.0\lib\netstandard1.6\Microsoft.Extensions.DependencyModel.dll".
                    C:\Users\James\.nuget\packages\microsoft.extensions.dependencymodel\1.0.0\lib\netstandard1.6\Microsoft.Extensions.DependencyModel.dll
            References which depend on "Microsoft.Extensions.DependencyModel, Version=1.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" [].
                C:\Users\James\.nuget\packages\microsoft.testplatform.testhost\15.0.0-preview-20170210-02\lib\netstandard1.5\Microsoft.TestPlatform.CrossPlatEngine.dll
                  Project file item includes which caused reference "C:\Users\James\.nuget\packages\microsoft.testplatform.testhost\15.0.0-preview-20170210-02\lib\netstandard1.5\Microsoft.TestPlatform.CrossPlatEngine.dll".
                    C:\Users\James\.nuget\packages\microsoft.testplatform.testhost\15.0.0-preview-20170210-02\lib\netstandard1.5\Microsoft.TestPlatform.CrossPlatEngine.dll
                    C:\Users\James\.nuget\packages\microsoft.testplatform.testhost\15.0.0-preview-20170210-02\lib\netstandard1.5\testhost.dll

We should promote 1# or something like it as the root message, and 2# as a nested message under the warning. VS will now hide by default messages that too long or contain multiple lines, and let the user expand to see more detail.

@nguerrera
Copy link
Contributor

💯

@rainersigwald
Copy link
Member

Dupe of #608. Copying your comments over there.

@ChicagoDave
Copy link

What if the diagnostic output shows the warning MSB3277, but doesn't list any conflicts?

@qwertie
Copy link

qwertie commented Dec 20, 2021

The worst thing about this message is that it seems to be saying that there is a conflict due to the assembly depending on itself. Look:

Found conflicts between different versions of "Microsoft.EntityFrameworkCore.Relational" that could not be resolved.
There was a conflict between "Microsoft.EntityFrameworkCore.Relational, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" and "Microsoft.EntityFrameworkCore.Relational, Version=6.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60".
  References which depend on "Microsoft.EntityFrameworkCore.Relational, Version=6.0.0.0...
    C:\Users\...\6.0.0\lib\net6.0\Microsoft.EntityFrameworkCore.Relational.dll
      Project file item includes which caused reference "C:\...\Microsoft.EntityFrameworkCore.Relational.dll".
        C:\Users\...\6.0.0\lib\net6.0\Microsoft.EntityFrameworkCore.Relational.dll

How f**king useless is that? Amazing that this isn't improved in VS 2022. It's not directly actionable because there is no indication what causes the conflict: our projects do not directly use or reference this DLL, and I can only assume the conflict has something to do with our NuGet packages.

Edit: actually it's supposed to be improved because the message begins by saying 'Found conflicts between different versions of "Microsoft.EntityFrameworkCore.Relational"' instead of "Found conflicts between different versions of the same dependent assembly". But in my case "Microsoft.EntityFrameworkCore.Relational" is already mentioned 7 times so I could already tell that the warning is somehow related to "Microsoft.EntityFrameworkCore.Relational".

@AR-May AR-May added the triaged label Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants