-
Notifications
You must be signed in to change notification settings - Fork 256
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
[Draft] Spec for Package Source Mapping Actions in PM UI #12616
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this write up. I'm not sure I follow how NuGet/NuGet.Client#5238 is a consequence of this proposal.
|
||
The customer could also try to update a package that is already mapped to a different source, but the source it is mapped to does not support the version they are trying to update to. In these scenarios, `Restore` will fail in the same way it does today. The customer can see why `Restore` failed in the output window. | ||
|
||
Currently, `NU1100` is used for both an incompatible TFM, and for a missing Package Source Mapping. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I mentioned in the issue, but NU1100 is always a missing package.
Missing package for source mapping vs not shouldn't matter. This was a deliberate decision at that point.
Ofc it can be a subject to change, but I think this particular statement is not correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So NU1100 says, PackageSourceMapping is enabled, the following source(s) were not considered: X, Y
.
How would you make that clearer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The proposal was for me to create something distinct. Copying from the Desired behavior in #12606:
Specific messages for either scenario.
Specify whether the TFM not compatible, or is the PackageSourceMapping not configured?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My point is that we already have different text for source mapping vs no source mapping scenarios. Are you proposing a new error code? This was something we considered and specifically opted against since when a package is not resolved, the issue could be, package doesn't exist, package exists but version doesn't, no suitable version can be selected etc. All of those get the same "due to source mapping, these sources were not considered". You can look at that in https://github.com/NuGet/NuGet.Client/blob/dev/src/NuGet.Core/NuGet.Commands/RestoreCommand/Diagnostics/UnresolvedMessages.cs by searching for isPackageSourceMappingEnabled
.
PR regarding this NuGet/NuGet.Client#4374.
For the 2nd line, compatibility has different warning/error codes, NU1100s vs NU1200s. In fact they are generated at different points, since in the first case there is no package, but in the 2nd case, there's a package that was analyzed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, when Svetlana and I were walking through the changes to PM UI, I'm sure we both saw a case where the package was available on a source, but we got a NU1100. I'll have to see if I can recreate that.
According to the docs, TargetFramework is called out as well:
Unable to resolve 'Dependency (>= 1.0.0)' for 'TargetFramework'
https://learn.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu1100
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the docs, TargetFramework is called out as well:
It's calling that out not because it is a compatibility problem, but because projects can multi target.
|
||
1. Currently, if an `Install`/`Update` cannot find transitive packages on the mapped source being mapped, the restore will fail. Reaching out to other configured sources and allowing the customer to select a different source for these packages may resolve this issue. However, care must be taken to avoid unintentionally leaking requested package IDs to these secondary sources when the customer hasn't agreed to such a query. | ||
|
||
1. If a package is found in the Global Packages Folder (GPF), the PM UI could look at the source in the `nupkg.metadata` file. A new mapping could either be created for this source auotmatically, or it could be presented to the customer in the Preview Window or another affordance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An idea would be:
- Use the mapping from the GPF if the source exists.
- Warning if the source doesn't.
I think https://github.com/NuGet/Client.Engineering/issues/1166 getting implemented will complement this nicely.
4f9703b
to
a79bebd
Compare
2ad6dfc
to
0bb97aa
Compare
ae7f1b8
to
ac99cf4
Compare
ac99cf4
to
ca798d1
Compare
This Draft PR has been replaced by PR # 12810
[Draft] Package Source Mapping Package Management Actions in the PM UI (shortcut to rendered spec)
Spec for: Issue # 11366