Repository navigation
Description
Hi, we've discovered recently that NuGet has native support for central package versioning CPVM. It is definitely a good step forward to simplify version management for large solutions, but it seems that there are some significant changes in how the restore errors are being reported.
Test solution
Let's assume that we have simple application with two library projects (SimpleAppWithLibs-Centralised.zip), e.g.:
App -> Lib1 -> Newtonsoft.Json (>= 9.0.1)
-> Lib2 -> Newtonsoft.Json.Bson (>= 1.0.2) -> Newtonsoft.Json (>= 12.0.1)
Problem
When we try to run dotnet restore for such solution then we get following error messages:
error NU1109: Detected package downgrade: Newtonsoft.Json from 12.0.1 to centrally defined 9.0.1. Update the centrally managed package version to a higher version. [...\Solution.sln]
error NU1109: App -> Newtonsoft.Json.Bson 1.0.2 -> Newtonsoft.Json (>= 12.0.1) [...\Solution.sln]
error NU1109: App -> Newtonsoft.Json (>= 9.0.1) [...\Solution.sln]
error NU1109: Detected package downgrade: Newtonsoft.Json from 12.0.1 to centrally defined 9.0.1. Update the centrally managed package version to a higher version. [...\Solution.sln]
error NU1109: Lib2 -> Newtonsoft.Json.Bson 1.0.2 -> Newtonsoft.Json (>= 12.0.1) [...\Solution.sln]
error NU1109: Lib2 -> Newtonsoft.Json (>= 9.0.1) [...\Solution.sln]
Failed to restore ...\Lib2\Lib2.csproj (in 300 ms).
Restored ...\Lib1\Lib1.csproj (in 299 ms).
Failed to restore ...\App\App.csproj (in 300 ms).
I appreciate the fact that by design restore operation works differently for CPVM enabled solutions compared to the non-CPVM case. My concern is that error reporting also works very differently, so for example error messages from above are repeated for each failed project. For large solutions containing hundreds of projects this can become very noisy.
Another issue is that one of the error messages suggests that App project has references to the Newtonsoft.Json and to the Newtonsoft.Json.Bson where actually it doesn't have any of these references. It is not clear from the error message that these are transitive references from Lib1 and Lib2.
Can you please confirm whether this is desired error reporting behaviour for CPVM enabled solutions?
Version
- dotnet.exe --version :
5.0.100-rc.2.20479.15
Activity
rconard commentedon Oct 15, 2020
@marcin-krystianc, thank you for sharing your feedback on CPVM's restore and pack.
Your issue is closely related to #10115. Could you take a look at that issue?
We would appreciate your giving feedback on that issue. If you are okay, I will merge these issues.
marcin-krystianc commentedon Oct 16, 2020
@rconard I see how these two issues are related but I think it is better to keep them separate.
My concern in this issue is only about how the version downgrade errors are being reported when the "transitive pinning" behaviour is enabled (regardless of whether it is the default or opt-in behaviour).
As I said in the previous comment, there are two problems with these error messages:
Maybe the transitive reference type can be marked with different type of arrow e.g. :
~>? So the example from previous comment would look like this:[-][CPVM] Package downgrade and error messages[/-][+][Bug]: Package downgrade and error messages[/+]