You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PackRef does not show transitive dependencies - install tab & update tab behavior? #5887
When using "legacy"-style .csproj project files we have a separate packages.config file where all dependencies are listed, including transitive ones. This allows a use case when one installs a package with dependencies and then decides which transitive dependencies can be manually updated. So, the benefits are:
Dependencies are easily identifiable due to presence of a flat list
Fine-grain control over all dependency versions
There are drawdowns of course: the flat list can blow up to a huge one.
E.g., after installing Autofac.WebApi2.Owin from NuGet, we have a picture like this:
Transitive dependencies which are clearly viewable can be manually updated very easily.
When using the new Sdk-style .csproj projects NuGet references are added as <PackageReference/> to the project file itself and transitive dependencies are resolved by MSBuild automatically:
So, to update transitive dependencies, one would have to
Identify them (e.g. via obj/project.assets.json)
Add all of them explicitly to the project
Perform updates
And this has to be done after each update and for every (!) transitive dependency in the project which is nearly impossible.
This seems like a "regression" to me.
The best possible resolution would be to show transitive dependency updates in NuGet GUI or via CLI. If the user decides to update one of the dependencies, it would get explicitly added to the project. (similar to #3159)
Maybe there is some workaround to achieve the specified behaviour?
Reacted by Mark Adamson, Markus Schaber, Mertsch, Avi Levin, Radek Falhar, Jevan Saks, Johan Larsson, kelly987654, Elte Hupkes, Doug Bunting and 11 more
I'm curious, why do you need this? Once you update the transitive dependency do you expect it to be hoisted into your project? Packages can remove dependencies in future versions so why does it matter that the dependency in transitive in the first place?
Why not just add the ones you care about explicitly updating manually to your project?
Once you update the transitive dependency do you expect it to be hoisted into your project?
When I explicitly update the dependency, I would like this fact to be somehow respected by NuGet and build tools, yes.
Packages can remove dependencies in future versions so why does it matter that the dependency in transitive in the first place?
Sorry, I do not fully understand your question. If I haven't updated a transitive dependency, it would be removed as it is now. If I have updated it, it should probably stay in the project but it's open for discussion.
My key point here is lack of control from the developer. In my opinion it is important to see the full list of dependencies a project references. I understand that this list can be quite big or depend on the target framework.
With packages.config I could see all the dependencies and their updates. I may or may not want to update them, but I do see them and can make the decision based on the change in version, release notes, etc.
Currently with <PackageReference/> the dependencies are a black box with almost zero control from the developer. The behaviour is quite similar to NPM which has always been a headache for frontend developers.
Currently it's not possible to obtain the list of dependencies and to update them in a human-friendly manner (NuGet GUI, CLI).
In my opinion, the most simple solution would be to add a <PackageReference/> to my project in case of a manual update of a particular package. Maybe, the element can be marked that it's just an update and not a direct reference by the project, so it can be removed if there are no packages depending on it.
Reacted by Johan Larsson, Lars Hiller Eidnes, Imre Pühvel, Sergei Krasnov and Nirmal Guru
Bug/security fixes in the dependencies
performance improvements
other reasons
Security fixes is a fair concern but honestly this is a rabbit hole, if you have a deep dependency chain and your other dependencies don't update, it's on you to directly reference and update those dependencies transitively. If those transitive dependencies are removed in a future version and you're still using it directly nothing is going to tell you to remove it. In the worst case what you'll end up with is the flattened graph
I'm not sure what you mean by performance improvements means.
I can't think of a single package manager that supports transitive dependencies that treats those transitive dependencies as if they were added top level (showing updates and allowing direct manipulation).
In my opinion, the most simple solution would be to add a to my project in case of a manual update of a particular package. Maybe, the element can be marked that it's just an update and not a direct reference by the project, so it can be removed if there are no packages depending on it.
I agree with the first part but not the rest. Once a dependency is hoisted to the top level, it's treated differently (like any other top level dependency) and you're responsible for updating it. IMO, the default experience should be the way it is today and you can have an option (checkbox in the ui or a command line switch) that shows updates for all transitive dependencies. Clicking update on one of these hoists it to a top level dependency and from then on you're on your own maintaining it like a top level dependency.
if you have a deep dependency chain and your other dependencies don't update, it's on you to directly reference and update those dependencies transitively.
Correct, I just want a human-friendly way to find and perform these updates as it has been with packages.config.
If those transitive dependencies are removed in a future version and you're still using it directly nothing is going to tell you to remove it. In the worst case what you'll end up with is the flattened graph
Yes, correct.
I'm not sure what you mean by performance improvements means.
I mean performance improvements in the updates. But it doesn't really matter, what matters is that reasons may be different.
I can't think of a single package manager that supports transitive dependencies that treats those transitive dependencies as if they were added top level (showing updates and allowing direct manipulation).
NuGet working with packages.config? :) (yes, I know that it just adds all dependencies as top-level ones)
I agree with the first part but not the rest. Once a dependency is hoisted to the top level, it's treated differently (like any other top level dependency) and you're responsible for updating it.
Fair enough.
IMO, the default experience should be the way it is today and you can have an option (checkbox in the ui or a command line switch) that shows updates for all transitive dependencies. Clicking update on one of these hoists it to a top level dependency and from then on you're on your own maintaining it like a top level dependency.
Sure, that was my idea in the first place, the "improvement" was just a proposal.
To sum up, IMO additional tab(s) in the NuGet UI with transitive dependencies and updates (and similar CLI switches) would bring back workflows that are similar to NuGet's behaviour with packages.config that some developers (including me) are so used to. Enabling such a thing can be implemented with a global switch in the settings and/or a project-level setting.
Reacted by Johan Larsson, Mateusz Kulesza, Nirmal Guru and Samisyke
As @akamyshanov pointed out, what if there's a critical security update in the update? Now you can say, "well, you can add Autofac back as a top level" but that then entirely defeats the point of having transitive dependencies.
Ideally, you'd want the things that depend on the thing with the security update to update as well right? That way you don't end up copying lots of leaf nodes to each project. Neither approach scales IMO, either way you'll end up with top level dependencies.
Ideally what we need is a mechanism to mark that the 2.1 update of Package B is a "TransitiveUpdate" and that if no top level projects or their dependencies depend on PackageB, it should be removed.
Lets take the scenario you mentioned, you start with this project:
Adding this new reference type to avoid the dangling reference problem doesn't buy you much IMO. Instead, maybe a prune command could be introduced to do the same operation (removed things that aren't used).
Reacted by Nikolche Kolev, Markus Schaber, Anand Gaurav, marcogruhl, Peter Palotas and Nirmal Guru
Interesting customer feedback from people who have migrated from Packages.Config to PackageReference. @rohit21agrawal, @nkolev92, @jainaashish - please add this user experience different to our PC->PR list of issues, so we can consider as a whole.
I think the security hotfix concept is a distraction here. Almost all updates aren't hotfixes; the vast majority of packages you use you will not use in a fashion that is typically exploitable - things that are exposed to the outside world are rare, so typically you'll be left with libs that don't check input for hostile content (but then again, it's not always the case this should be the libs responsibility in the first place).
There's a tradeoff here: do you want the normal workflow to be as smooth as possible (and thus not cluttered with indirect package references that you can really only mess up)? Or do you want to force everyone to explicitly decide about updates, so that potentially security relevant updates (those rare cases!) aren't missed? And don't forget that semver isn't (and cannot really) be enforced: so by updating indirect dependencies, even minor version, you can break your app. It's not even all that unlikely; you merely need to depend on some implementation detail the library does not consider relevant (e.g. the type of return value of some method is unchanged, but the order unspecified and now different!) but you, perhaps unintentionally, depend on.
I think explicitly choosing for simplicity is wise here; the new-style package references with implicit transitive dependencies were the right choice, and that remains so.
If indeed the risk of missing security updates is real - and i'm not saying it isn't - then perhaps there are other approaches to dealing with that with fewer downsides. E.g., it would be cool if a package (version) could be marked obsolete or even explicitly insecure; something like the suggestions made in #2867 sounds more targeted, and really even better for security too.
@EamonNerbonne Everything you're saying is correct, however security updates are just an example. It's not the reason I'd like to focus on but the choice.
do you want the normal workflow to be as smooth as possible (and thus not cluttered with indirect package references that you can really only mess up)?
Yes, of course, smooth workflows are cool :)
Or do you want to force everyone to explicitly decide about updates, so that potentially security relevant updates (those rare cases!) aren't missed?
Absolutely not, I do not want anyone forcing anybody their workflows, that's the point. As stated earlier, this can be an optional switch that enables separate tabs in the UI.
I think explicitly choosing for simplicity is wise here; the new-style package references with implicit transitive dependencies were the right choice, and that remains so.
Not arguing that it's the right choice, I do believe that it really is for a majority of developers.
I just want a way to be able to view all transitive references as a flat list (without going through the tree manually) and decide if I want to update them.
Reacted by Mark Adamson, Alex Zyl, Markus Schaber, Joel Lord and Andrew Timson
While you all may not be included in the experiment group today, we believe this work concludes the spirit of this issue. If we find no major bugs or perf issues in our experiments, we will release it to everyone in the next major release.
For further feedback on enhancing this experience or the existing dotnet list package --include-transitive, please file a new issue for us to track.
@JonDouglas Has this been removed from Visual Studio again? I remember that I saw the transitive packages in the NuGet package manager in Visual Studio some time ago, but now (with VS version 17.5.5) I don't see it any more.
@JonDouglas I've just updated to VS 17.6 and still don't see the transitive dependencies. When will this be released? Is there an (open) issue that I could follow?
edit: I can now see the transitive dependencies in VS 17.6.3
@JonDouglas I've just updated to VS 17.6 and still don't see the transitive dependencies. When will this be released? Is there an (open) issue that I could follow?
edit: I can now see the transitive dependencies in VS 17.6.3
Is there something specific that needs to be done to enable this? I'm using VS 17.12.0 Preview 2.1 and I don't see transitive dependencies in the NuGet package manager
@JonDouglas I've just updated to VS 17.6 and still don't see the transitive dependencies. When will this be released? Is there an (open) issue that I could follow?
edit: I can now see the transitive dependencies in VS 17.6.3
Is there something specific that needs to be done to enable this? I'm using VS 17.12.0 Preview 2.1 and I don't see transitive dependencies in the NuGet package manager
@Halofreak1990 Are you looking at the NuGet Package Manager UI for one project? That should show transitive dependencies.
But the NuGet Package Manager UI for a whole solution will not show them.
@Halofreak1990 Are you looking at the NuGet Package Manager UI for one project? That should show transitive dependencies. But the NuGet Package Manager UI for a whole solution will not show them.
This now exists in 17.12 Previews I believe(not sure exact release atm). We added solution level and have a blog coming soon.
Activity
[-]List and allow transitive dependency updates[/-][+]List transitive dependency updates and allow manual update[/+]davidfowl commentedon Sep 14, 2017
I'm curious, why do you need this? Once you update the transitive dependency do you expect it to be hoisted into your project? Packages can remove dependencies in future versions so why does it matter that the dependency in transitive in the first place?
Why not just add the ones you care about explicitly updating manually to your project?
akamyshanov commentedon Sep 14, 2017
@davidfowl
Thank you for the answer.
When I explicitly update the dependency, I would like this fact to be somehow respected by NuGet and build tools, yes.
Sorry, I do not fully understand your question. If I haven't updated a transitive dependency, it would be removed as it is now. If I have updated it, it should probably stay in the project but it's open for discussion.
My key point here is lack of control from the developer. In my opinion it is important to see the full list of dependencies a project references. I understand that this list can be quite big or depend on the target framework.
packages.configI could see all the dependencies and their updates. I may or may not want to update them, but I do see them and can make the decision based on the change in version, release notes, etc.<PackageReference/>the dependencies are a black box with almost zero control from the developer. The behaviour is quite similar to NPM which has always been a headache for frontend developers.Currently it's not possible to obtain the list of dependencies and to update them in a human-friendly manner (NuGet GUI, CLI).
In my opinion, the most simple solution would be to add a
<PackageReference/>to my project in case of a manual update of a particular package. Maybe, the element can be marked that it's just an update and not a direct reference by the project, so it can be removed if there are no packages depending on it.davidfowl commentedon Sep 14, 2017
Security fixes is a fair concern but honestly this is a rabbit hole, if you have a deep dependency chain and your other dependencies don't update, it's on you to directly reference and update those dependencies transitively. If those transitive dependencies are removed in a future version and you're still using it directly nothing is going to tell you to remove it. In the worst case what you'll end up with is the flattened graph
I'm not sure what you mean by performance improvements means.
I can't think of a single package manager that supports transitive dependencies that treats those transitive dependencies as if they were added top level (showing updates and allowing direct manipulation).
I agree with the first part but not the rest. Once a dependency is hoisted to the top level, it's treated differently (like any other top level dependency) and you're responsible for updating it. IMO, the default experience should be the way it is today and you can have an option (checkbox in the ui or a command line switch) that shows updates for all transitive dependencies. Clicking update on one of these hoists it to a top level dependency and from then on you're on your own maintaining it like a top level dependency.
akamyshanov commentedon Sep 14, 2017
Correct, I just want a human-friendly way to find and perform these updates as it has been with
packages.config.Yes, correct.
I mean performance improvements in the updates. But it doesn't really matter, what matters is that reasons may be different.
NuGet working with
packages.config? :) (yes, I know that it just adds all dependencies as top-level ones)Fair enough.
Sure, that was my idea in the first place, the "improvement" was just a proposal.
To sum up, IMO additional tab(s) in the NuGet UI with transitive dependencies and updates (and similar CLI switches) would bring back workflows that are similar to NuGet's behaviour with
packages.configthat some developers (including me) are so used to. Enabling such a thing can be implemented with a global switch in the settings and/or a project-level setting.davidfowl commentedon Sep 15, 2017
Ideally, you'd want the things that depend on the thing with the security update to update as well right? That way you don't end up copying lots of leaf nodes to each project. Neither approach scales IMO, either way you'll end up with top level dependencies.
Lets take the scenario you mentioned, you start with this project:
Autofac.Owin 4.0.0 -> Autofac 4.0.0 -> System.Magic 1.0.0
Time goes by and there's a new version of Autofac 4.0.1 but there's no new Autofac.Owin. So you use this fancy new feature we just invented:
Then there's another security update for System.Magic 1.0.3:
Adding this new reference type to avoid the dangling reference problem doesn't buy you much IMO. Instead, maybe a prune command could be introduced to do the same operation (removed things that aren't used).
rrelyea commentedon Sep 21, 2017
Interesting customer feedback from people who have migrated from Packages.Config to PackageReference. @rohit21agrawal, @nkolev92, @jainaashish - please add this user experience different to our PC->PR list of issues, so we can consider as a whole.
EamonNerbonne commentedon Sep 22, 2017
I think the security hotfix concept is a distraction here. Almost all updates aren't hotfixes; the vast majority of packages you use you will not use in a fashion that is typically exploitable - things that are exposed to the outside world are rare, so typically you'll be left with libs that don't check input for hostile content (but then again, it's not always the case this should be the libs responsibility in the first place).
There's a tradeoff here: do you want the normal workflow to be as smooth as possible (and thus not cluttered with indirect package references that you can really only mess up)? Or do you want to force everyone to explicitly decide about updates, so that potentially security relevant updates (those rare cases!) aren't missed? And don't forget that semver isn't (and cannot really) be enforced: so by updating indirect dependencies, even minor version, you can break your app. It's not even all that unlikely; you merely need to depend on some implementation detail the library does not consider relevant (e.g. the type of return value of some method is unchanged, but the order unspecified and now different!) but you, perhaps unintentionally, depend on.
I think explicitly choosing for simplicity is wise here; the new-style package references with implicit transitive dependencies were the right choice, and that remains so.
If indeed the risk of missing security updates is real - and i'm not saying it isn't - then perhaps there are other approaches to dealing with that with fewer downsides. E.g., it would be cool if a package (version) could be marked obsolete or even explicitly insecure; something like the suggestions made in #2867 sounds more targeted, and really even better for security too.
akamyshanov commentedon Sep 25, 2017
@EamonNerbonne Everything you're saying is correct, however security updates are just an example. It's not the reason I'd like to focus on but the choice.
Yes, of course, smooth workflows are cool :)
Absolutely not, I do not want anyone forcing anybody their workflows, that's the point. As stated earlier, this can be an optional switch that enables separate tabs in the UI.
Not arguing that it's the right choice, I do believe that it really is for a majority of developers.
I just want a way to be able to view all transitive references as a flat list (without going through the tree manually) and decide if I want to update them.
44 remaining items
Pilchard123 commentedon Aug 11, 2022
This MS devblog seems relevant to the discussion here.
Introducing Transitive Dependencies in Visual Studio
JonDouglas commentedon Aug 11, 2022
Hi friends,
🎉 We recently released an experiment in Visual Studio 17.3 regarding this feature. 🎉
https://devblogs.microsoft.com/nuget/introducing-transitive-dependencies-in-visual-studio/
While you all may not be included in the experiment group today, we believe this work concludes the spirit of this issue. If we find no major bugs or perf issues in our experiments, we will release it to everyone in the next major release.
For further feedback on enhancing this experience or the existing
dotnet list package --include-transitive, please file a new issue for us to track.Thus we are closing this issue as completed!
alex-jitbit commentedon Mar 9, 2023
It's been almost 2 years and I still don't see dependencies in Visual Studio
cremor commentedon May 10, 2023
@JonDouglas Has this been removed from Visual Studio again? I remember that I saw the transitive packages in the NuGet package manager in Visual Studio some time ago, but now (with VS version 17.5.5) I don't see it any more.
JonDouglas commentedon May 10, 2023
@cremor We're gearing up to release it for everyone as we ran into a few performance regressions we had to resolve. /cc @jebriede
cremor commentedon May 22, 2023
@JonDouglas I've just updated to VS 17.6 and still don't see the transitive dependencies. When will this be released? Is there an (open) issue that I could follow?
edit: I can now see the transitive dependencies in VS 17.6.3
Halofreak1990 commentedon Oct 10, 2024
Is there something specific that needs to be done to enable this? I'm using VS 17.12.0 Preview 2.1 and I don't see transitive dependencies in the NuGet package manager
JonDouglas commentedon Oct 10, 2024
Can you provide a screenshot?
cremor commentedon Oct 10, 2024
@Halofreak1990 Are you looking at the NuGet Package Manager UI for one project? That should show transitive dependencies.
But the NuGet Package Manager UI for a whole solution will not show them.
Halofreak1990 commentedon Oct 10, 2024
@cremor, no, I was looking at the solution-level NuGet packages. I can indeed see the transitive packages on the project level. Thanks.
JonDouglas commentedon Oct 10, 2024
This now exists in 17.12 Previews I believe(not sure exact release atm). We added solution level and have a blog coming soon.
nkolev92 commentedon Oct 10, 2024
17.12 preview 3 is where the transitive dependencies on the solution level PM UI will go live.
Please wait for another week or so and update then.