Add new option for json output of dotnet list package to release 7.2.xx branch#29017
Conversation
baronfel
left a comment
There was a problem hiding this comment.
A few notes around how we could leverage System.CommandLine features to have a more consistent experience with the rest of the .NET CLI.
src/Cli/dotnet/commands/dotnet-list/dotnet-list-package/ListPackageReferencesCommandParser.cs
Outdated
Show resolved
Hide resolved
src/Cli/dotnet/commands/dotnet-list/dotnet-list-package/ListPackageReferencesCommandParser.cs
Outdated
Show resolved
Hide resolved
src/Cli/dotnet/commands/dotnet-list/dotnet-list-package/LocalizableStrings.resx
Outdated
Show resolved
Hide resolved
9811a04 to
c4c98a3
Compare
|
@baronfel |
|
I built and ran this PR to get a sense of the help output: D:///////dotnet on dev-eryondon-add-dotnetlistpackage-formatoption2 ≡ 2
08:54:21 ❯ .\dotnet.exe list package --help
Description:
List all package references of the project or solution.
Usage:
dotnet list [<PROJECT | SOLUTION>] package [options]
Arguments:
<PROJECT | SOLUTION> The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. [default:
D:\Code\dotnet-sdk\artifacts\bin\redist\Debug\dotnet\]
Options:
-v, --verbosity <LEVEL> Set the MSBuild verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic].
--outdated Lists packages that have newer versions. Cannot be combined with '--deprecated' or '--vulnerable' options.
--deprecated Lists packages that have been deprecated. Cannot be combined with '--vulnerable' or '--outdated' options.
--vulnerable Lists packages that have known vulnerabilities. Cannot be combined with '--deprecated' or '--outdated' options.
--framework <FRAMEWORK | FRAMEWORK\RID> Chooses a framework to show its packages. Use the option multiple times for multiple frameworks.
--include-transitive Lists transitive and top-level packages.
--include-prerelease Consider packages with prerelease versions when searching for newer packages. Requires the '--outdated' option.
--highest-patch Consider only the packages with a matching major and minor version numbers when searching for newer packages. Requires the '--outdated' option.
--highest-minor Consider only the packages with a matching major version number when searching for newer packages. Requires the '--outdated' option.
--config <CONFIG_FILE> The path to the NuGet config file to use. Requires the '--outdated', '--deprecated' or '--vulnerable' option.
--source <SOURCE> The NuGet sources to use when searching for newer packages. Requires the '--outdated', '--deprecated' or '--vulnerable' option.
--interactive Allows the command to stop and wait for user input or action (for example to complete authentication).
--format <FORMAT> Specifies the output format type for the list packages command.
-?, -h, --help Show command line help.I noticed that the valid choices for the output format weren't shown - instead the D:///////dotnet on dev-eryondon-add-dotnetlistpackage-formatoption2 ≡ ~1 2
09:03:31 ❯ .\dotnet.exe list package --help
Description:
List all package references of the project or solution. Usage:
dotnet list [<PROJECT | SOLUTION>] package [options]
Arguments:
<PROJECT | SOLUTION> The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. [default:
D:\Code\dotnet-sdk\artifacts\bin\redist\Debug\dotnet\]
Options:
-v, --verbosity <LEVEL> Set the MSBuild verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic].
--outdated Lists packages that have newer versions. Cannot be combined with '--deprecated' or '--vulnerable' options.
--deprecated Lists packages that have been deprecated. Cannot be combined with '--vulnerable' or '--outdated' options.
--vulnerable Lists packages that have known vulnerabilities. Cannot be combined with '--deprecated' or '--outdated' options.
--framework <FRAMEWORK | FRAMEWORK\RID> Chooses a framework to show its packages. Use the option multiple times for multiple frameworks.
--include-transitive Lists transitive and top-level packages.
--include-prerelease Consider packages with prerelease versions when searching for newer packages. Requires the '--outdated' option.
--highest-patch Consider only the packages with a matching major and minor version numbers when searching for newer packages. Requires the '--outdated' option.
--highest-minor Consider only the packages with a matching major version number when searching for newer packages. Requires the '--outdated' option.
--config <CONFIG_FILE> The path to the NuGet config file to use. Requires the '--outdated', '--deprecated' or '--vulnerable' option.
--source <SOURCE> The NuGet sources to use when searching for newer packages. Requires the '--outdated', '--deprecated' or '--vulnerable' option.
--interactive Allows the command to stop and wait for user input or action (for example to complete authentication).
--format <console|json> Specifies the output format type for the list packages command.
-?, -h, --help Show command line help.note the change in the way the formats are displayed. I think you should remove the use of ArgumentHelpName and the resource text for that. What do you think? You can test this output yourself by building via |
I tried to test locally build dotnet binary, but it's failing because it doesn't have latest nuget binary. Should I cherry-pick my change (NuGet/NuGet.Client#4855) to nuget 6.4 and create PR to merge to release/7.0.2xx? Or instead, I just continue with other sdk PR #28564 for sdk main branch? Currently our nuget asset inserted to sdk main branch only. |
I imagine the SDK will eventually setup rules so that our 6.5 insertions go in 7.0.2xx. 6.4 NuGet matches 7.0.1xx of the .NET SDK. |
@baronfel @dsplaisted |
|
@marcpopMSFT What do we need to do to set up flow from NuGet 6.5 into release/7.0.2xx? This PR is blocked on that I believe. |
|
There is already codeflow for 17.5 to main and 7.0.2xx (see subscription d74d256b-6327-493c-3777-08daa2f83374). Nuget just controls when they promote a build to flow. @kartheekp-ms on whether there are 17.5 flows coming soon. |
|
@erdembayar - I am bit confused. I assume this change should be made to Line 104 in 840f689 release/7.0.2xx branch don't have the NuGet side implementation for dotnet list package json output functionality.
@marcpopMSFT - The url says |
|
Good catch as I didn't notice the type before. Fixed the dotnet and triggered: #29113 |
Looks good now. |
This one flow into main later. |
|
@dsplaisted |
It would be good to add a sanity check test that verifies that the new option works correctly. Barring that, try testing locally again and see if it works (after merging in the latest changes from |
|
@dsplaisted |
|
If you mean an installable SDK, we need a CI build of 7.0.2xx first (I don't see one started for this PR yet), then codeflow into installer, then a ci build there. So half a day to a few days from now (we usually don't track individual changes that closely in codeflow). |
|
Where can I get latest nightly build? |
|
@erdembayar the table with the various download links for the nightly SDK installers is here. I think there's a delay in the codeflow, though, blocked by this PR which has a lot of discussion about NuGet.Client and SourceBuild prebuilts, so I'm not sure that the version of 7.0.2xx listed in that table would have your changes yet. |


Related to: NuGet/NuGet.Client#4855
Add new
--formatoption fordotnet list packagecommand. NuGet change was inserted to sdk here: #28913