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

Nuget Packages Manager screen for Solution automatically selects transitive dependencies #13893

Closed
vsfeedback opened this issue Oct 30, 2024 · 9 comments · Fixed by NuGet/NuGet.Client#6179
Assignees
Labels
Functionality:Install The install command in VS/nuget.exe Priority:1 High priority issues that must be resolved in the current sprint. Product:VS.Client Style:PackageReference Transferred issue This issue is transferred from VSFeedback or other github repo Type:DCR Design Change Request
Milestone

Comments

@vsfeedback
Copy link

This issue has been moved from a ticket on Developer Community.


In the Nuget Packages Manager screen for solution, in the "Updates" list, when selecting a package to update, all the projects when the package is top-level AND transitive are automatically selected.

TransitivePackagesAutoSelected.png

Clicking the Update button (underneath the Uninstall button) will update the package reference for the top-level registration, but also add a package reference in all the projects where the package is used as a transitive dependency. Which is not the intended use of transitive dependencies.

I would expect to only have the project where the dependency is a top-level one to be selected automatically.

The solution I'm working with a .NET Framework 4.8 solution, using PackageReference and with SDK-style projects.

PS: when updating multiple packages at once, by selecting them in the package list of the Update tab, and clicking the "Update" button located on top of that list, only the projects where the dependencies are top-level are updated, which is the intended behavior.


Original Comments

Feedback Bot on 28/10/2024, 00:10 PM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

@microsoft-github-policy-service microsoft-github-policy-service bot added Transferred issue This issue is transferred from VSFeedback or other github repo Triage:Untriaged labels Oct 30, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the missing-required-type The required type label is missing. label Oct 30, 2024
@nkolev92 nkolev92 added Type:DCR Design Change Request Priority:1 High priority issues that must be resolved in the current sprint. and removed missing-required-type The required type label is missing. labels Oct 30, 2024
@NextFreeUsername
Copy link

This!
It makes no sense at all to add top level version dependencies that would get their update simply through project references.
While upgrading from .Net 6 to .Net 8 (and not .Net 9), setting the version to the max .Net 8 version for all those extra Microsoft packages currently means unchecking endless boxes of transitive dependencies.

@SymboLinker
Copy link

If:

  • project A and B are in the same solution,
  • project A references package X,
  • project B references project A,
  • and package X needs an update.

then the NuGet package manager in Visual Studio should:

  • only pre-select the checkbox for updating package X for project A.
  • not pre-select the checkbox for (updating=)adding package X to project B.

Update Package X:

src/A     Top-level    [yes, preselect]
src/B     Transitive   [no, do not pre-select]

@BrechtLaitem
Copy link

Any news on this one? It makes updating packages in VS really difficult.

@pjmvp
Copy link

pjmvp commented Nov 29, 2024

Agreed. Was this a mistake or did someone actually think this default behaviour was a good idea?

If I have a main project "A" (e.g. a Web API) with a dependency on a class library project "B" (e.g. some Data Access DLL) which in turn depends on some DB-access NuGet packages, I don't think anyone wants the default behaviour of "Update NuGet packages for solution" to be "include all transitive packages from dependent-project B in main-project A".

As of today I have to manually un-select the transitive dependencies, so that only the class library project's (top-level) dependency gets updated. Very cumbersome in a large project, as this has to be done for each NuGet package. Or, use the "Update NuGet packages" on a project by project basis.

There are, of course, occasions where one might want to explicitly install a transitive dependency in the "main" project, but I'd assume that's usually the exception and not the norm...

@eccc-fp
Copy link

eccc-fp commented Dec 2, 2024

I just went through one of many solutions, this is painful, please fix it

(not mentioning the LTS vs STS... but that is another issue)

@pjmvp
Copy link

pjmvp commented Dec 3, 2024

@martinrrm thanks for listening to our feedback!
Looking forward to this. 🙌

@AmilaDotDev
Copy link

Just want to check when we can expect this to be fixed on Visual Studio 22. I just updated to preview version to check if it has been fixed (17.13.0 Preview 2.1), but it still selects transitive packages when I try to update packages on the solution.

@edbenson
Copy link

edbenson commented Feb 3, 2025

Just want to check when we can expect this to be fixed on Visual Studio 22. I just updated to preview version to check if it has been fixed (17.13.0 Preview 2.1), but it still selects transitive packages when I try to update packages on the solution.

This is fixed in Visual Studio 2022 v17.13 preview 4 which was released on 28 January 2025.

@AmilaDotDev
Copy link

Thanks for the update, can confirm NuGet package Manager only select Top-level dependencies when trying to update packages. Thanks

@Nigusu-Allehu Nigusu-Allehu added this to the 6.13 milestone Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Functionality:Install The install command in VS/nuget.exe Priority:1 High priority issues that must be resolved in the current sprint. Product:VS.Client Style:PackageReference Transferred issue This issue is transferred from VSFeedback or other github repo Type:DCR Design Change Request
Projects
None yet
Development

Successfully merging a pull request may close this issue.