-
Notifications
You must be signed in to change notification settings - Fork 252
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
Machine readable output for dotnet list package #7752
Comments
Hey @adamdriscoll @rrelyea @anangaur to chip in on how they'd want this done. I personally prefer a json option. |
Json seems fine as most of NuGet generated artifacts are json too. @adamdriscoll , If you could start with a one pager that includes the proposal on output i.e. the structure of the data and how sample output would look like with different options, that can be a good start. We can review the proposal and then suggest/make changes as required. Since this is not on our priority list, it would be difficult for us to propose a full spec on this in near term. |
json will be good to have. |
Having a Based on today's (and planned) console output, here's a suggestion. outdated.jsonCommand:
deprecated.jsonCommand:
installed-packages.jsonCommand: This would be very similar to the |
Should it be For multi-targetting, there is a trade-off (size of the file) between listing the packages separately for each framework vs. having this info as an attribute for each package. I like the current approach better though. |
No strong opinion :)
The current model happens to correspond with the in-memory model used for console printing, which is rather convenient. |
Announcement for the spec review: NuGet/Announcements#35 |
@anangaur @xavierdecoster Can you please put the spec in a PR to the https://github.com/NuGet/Client.Engineering repo? It's very difficult to leave comments on a spec that's in the wiki. |
I agree with moving the spec to a PR so feedback can be provided more easily. In addition, the json format needs to take into account that it's possible to run |
Agree with having the specs as files than wiki. I will try to find a place, for next specs. A common place than having client vs. server places. |
A couple of comments from a first look (please PR it!).
|
Thanks, will update. Where should the spec files go (and the PR)? :) |
Start with https://github.com/NuGet/Client.Engineering, unless @anangaur is ready with a new repo? :) |
Home/wiki, for now :) |
Another dup in #9524 |
Is there any progress on this issue ? |
I'm working on implementation, since this's the 1st ever json output for .net cli tooling still discovering new thing. |
Awesome to see the progress on this @erdembayar ! |
Thank you for your interest, I just merged the PR for json output, in that PR I refactored the coupled code to MVC style code so next time someone can add |
Very cool :) hoop to see this soon :) |
If anyone want to test out, it's already in public nightly build: https://github.com/dotnet/installer#table |
Alternatively, you can install latest binary from here |
@erdembayar Thanks for the great work! However, I am a bit confused. The documentation has been updated a few days ago (https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-list-package) - so I was assuming that this feature is ready to use in production. Sadly the latest .NET 7.0.2 from January 10, 2023 contains .NET SDK 7.0.102 and is missing the feature. I know that I can manually install the latest build but I want to use it within an Azure Pipeline. Can you advise? |
Here is the PR#32855 for doc change. I explicitly asked not to merge until it's GA, but someone merged it, considering it was for |
Thanks for clarifying! Any idea when NET SDK 7.0.2xxx will be GA? |
Sorry, I couldn't tell exactly, but looking at https://dotnet.microsoft.com/en-us/download/dotnet/7.0 release dates, it usually happens every 1 month, so I estimate sometime in Feb,2023. |
This feature is GA now with .NET SDK 7.0.200 🥳, please download from https://dotnet.microsoft.com/en-us/download/dotnet/7.0 |
Details about Problem
It is difficult to parse the output of
dotnet list package
. We have requirements in our organization to audit packages that we are using in our projects. Without having a good way to parse the output of this command, it makes it difficult to structure the list of packages in a way that can be fed into another auditing system.Running the following command produces the following output:
The problem with this type of output is that it is difficult to parse. npm provides two options that make this easier when listing packages. They include both a
-parsable
and a-json
parameter. I thinkdotnet list package
should provide something similar.I think that
dotnet list package
should do something similar.I'm happy to work on a PR for this. I've found the responsible code and could implement a "parse-friendly" version but wanted feedback from the community\team before doing anything.
https://github.com/NuGet/NuGet.Client/blob/dev/src/NuGet.Core/NuGet.CommandLine.XPlat/Utility/ProjectPackagesPrintUtility.cs
Update 12/10/2021:
After diving into this issue, it's quite large issue, it looks none of dotnet command implemented it, this is 1st time. Let's divide and conquer this issue, here're sub issues:
Spec proposal PR: Spec for machine readable json output for dotnet list package #11446
The text was updated successfully, but these errors were encountered: