-
Notifications
You must be signed in to change notification settings - Fork 255
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
NuGet did not recognized package version conflict across projects #10302
Comments
Please refer to repository https://github.com/ChuckTest/NuGet-10302 The point is System.Text.Json (>= 4.7.2) depends on System.ValueTuple (>= 4.5.0) When I reference CsvHelper 12.1.2 in ConsoleApp1, the package.config install System.ValueTuple 4.4 for me. |
This looks to me like the "nearest wins" rule, which means this is working as expected. Is that right, @nkolev92 ? |
This is packages.config, not PackageReference.
If you tried the same set-up with PackageReference: CLassLibrary-> Microsoft.Extensions.Configuration.Json 3.1.6 I'd expect that 4.5.0 of System.Value.Tuple gets resolved. In this case, 4.5.0 gets resolved because they are cousin dependencies. Basically they'd need to be part of the same subgraph to apply nearest wins, and that's usually going to be accompanied with a warning. edit |
Basically to make it easier...think about it this way: Console -> Library -> MECJ 3.1.6 -> STJ 4.7.2 - SV 4.5.0 They are not part of the same subgraph, so in a latter pass, we pick 4.5.0 over 4.40. Console -> Library -> MECJ 3.1.6 -> STJ 4.7.2 - SV 4.5.0 This would cause 4.4.0 to be selected, because Library explicitly downgrade SV to 4.4.0. You also get a warning to help you with that in NU1605 (which is elevated to an error by default in SDK projects). |
I will get an msbuild warning when I try to rebuild the solution, the message is not clear and seems to be fixed dotnet/msbuild#608
I just wonder if the nuget can fix this automatically. |
I have created two branches for tests, it seems the different reference order make the auto bindingRedirect behave differently And at last, the bindingRedirect is different for these two mode. console-app-first mode will lose bindingRedirect for System.ValueTuple.
// packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll |
When I compare the branches, ChuckTest/NuGet-10302@class-library-first...console-app-first, I see thjat in one the packages are installed and they aren't in the other one. Maybe there's something that hasn't been pushed yet? |
Hi @nkolev92 , I suggest you to clone the repository to local and compare the branches on local computer. By the way, the compare feature of GitHub is really horrible, I have already reported two other bugs for it. Now, a new bug emerged. I will not report this new bug to GitHub this time, just remember do not try to compare branches on web. |
I can see the difference. Can you please confirm the repro steps again?
vs
|
@nkolev92 Yes, the reproduce steps are correct. And the step 4 in first reproduce is "Add CvsHelper 12.1.2 in console app". |
Hey @chucklu Trying to follow those steps, I was not able to see the behavior you are observing. When you install the packages, what's the Dependency Behavior you are selecting? |
@nkolev92 The library referenced by class library should be Microsoft.Extensions.Configuration.Json instead of Microsoft.Extensions.Configuration |
Ok, following those instructions, I don't quite see the same thing as you. I notice the slight different in binding redirects, but they are not missing. Note that the binding redirects are applied at package installation time, so this is a design flaw of how binding redirects are handled in packages.config. You can consider disabling NuGet's binding redirects and add https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/how-to-enable-and-disable-automatic-binding-redirection. Note that because of this in PackageReference, NuGet does not handle the binding redirects. |
cc @kartheekp-ms who's on hot seat and can help with the investigation further if necessary. |
@nkolev92 I tried again based on commit ChuckTest/NuGet-10302@a4d90e2 in my repository. |
I cloned https://github.com/ChuckTest/NuGet-10302 repo and turned-on verbose logging for MSBuild in Visual Studio. This issue is related to dotnet/sdk#1897 issue as MSBuild encountered a conflict between
|
There are no SDK projects in this question, so the SDK issue is not relevant in this case. |
Details about Problem
VS version (if appropriate):
Microsoft Visual Studio Professional 2019
Version 16.7.7
OS version (i.e. win10 v1607 (14393.321)):
win10 1909
Detailed repro steps so we can see the same problem
I will provide a git repository later according the issue id
The text was updated successfully, but these errors were encountered: