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
Copy file name to clipboardExpand all lines: proposed/2021/MachineReadableOutput.md
+35-13Lines changed: 35 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,8 +48,6 @@ dotnet list [<PROJECT>|<SOLUTION>] package [--config <SOURCE>]
48
48
dotnet list package -h|--help
49
49
```
50
50
51
-
`<FORMAT>` - Allowed values as part of spec is `json`. Also `text` is acceptable value too, it'll just output current cli output. (In the future `parseable`, `csv`, `yaml`, `xml` could be candidates.)
52
-
53
51
#### `> dotnet list package`
54
52
55
53
```dotnetcli
@@ -80,6 +78,7 @@ Project 'MyProjectB' has the following package references
80
78
"projects": {
81
79
"MyProjectA": [
82
80
{
81
+
"Path": "src/tool/MyProjectA.csproj",
83
82
"framework": "netcoreapp3.1",
84
83
"topLevelPackages": [
85
84
{
@@ -102,6 +101,7 @@ Project 'MyProjectB' has the following package references
102
101
],
103
102
"MyProjectB": [
104
103
{
104
+
"Path": "src/lib/MyProjectB.csproj",
105
105
"framework": "netcoreapp3.1",
106
106
"topLevelPackages": [
107
107
{
@@ -117,6 +117,7 @@ Project 'MyProjectB' has the following package references
117
117
]
118
118
},
119
119
{
120
+
"Path": "src/lib/MyProjectB.csproj",
120
121
"framework": "net5.0",
121
122
"topLevelPackages": [
122
123
{
@@ -175,6 +176,7 @@ Project `MyProjectB` has the following updates to its packages
175
176
"projects": {
176
177
"MyProjectA": [
177
178
{
179
+
"Path": "src/tool/MyProjectA.csproj",
178
180
"framework": "netcoreapp3.1",
179
181
"topLevelPackages": [
180
182
{
@@ -200,6 +202,7 @@ Project `MyProjectB` has the following updates to its packages
200
202
],
201
203
"MyProjectB": [
202
204
{
205
+
"Path": "src/tool/MyProjectB.csproj",
203
206
"framework": "netcoreapp3.1",
204
207
"topLevelPackages": [
205
208
{
@@ -217,6 +220,7 @@ Project `MyProjectB` has the following updates to its packages
217
220
]
218
221
},
219
222
{
223
+
"Path": "src/tool/MyProjectB.csproj",
220
224
"framework": "net5.0",
221
225
"topLevelPackages": [
222
226
{
@@ -271,8 +275,10 @@ Project `MyProjectB` has the following deprecated packages
*https://github.com/NuGet/Home/blob/dotnet-audit/proposed/2021/DotNetAudit.md#dotnet-audit---futjson There're some overlaps, but current spec is one more focused on SBOM and CI/CD actions, while `dotnet audit fix` is more focused detecting/fixing dependencies manually. Current spec already include ideas from this spec like `json format`.
*https://github.com/NuGet/Home/wiki/%5BSpec%5D-Machine-readable-output-for-dotnet-list-package Basic idea from this spec is still same here and I extended from it. In current spec more orient to `dotnet style syntax` and cover more uses cases like `dotnet list package --vulnerable --format json` and `--include-transitive`, also json schema improved to include project name/identifier for multi-project scenario which would most likely use case.
614
628
615
-
## Unresolved Questions
629
+
*https://docs.microsoft.com/en-us/dotnet/core/diagnostics/dotnet-counters One idea we can take from `dotnet counter` is we can specify output file with `-o`, `--output` option. So instead of writing output into console, it allows output directly saved into file. It allows both `csv` and `json` formats, currently saved file doesn't have version concept.
616
630
617
-
* Chris: One problem is most `dotnet list package` options outputs are exclusive and have to query separately and join result to get full picture. Both below approach require additional work.
618
-
* dotnet cli needs an all up `dotnet list package --all` that shows all deprecated, vulnerable, and outdated top level and transitive packages. [r766860629](https://github.com/NuGet/Home/pull/11446#discussion_r766860629)
619
-
* Alternatively the behavior of --outdated and --deprecated could be additive rather than exclusive. That adds to the scope of this work though.[r766860629](https://github.com/NuGet/Home/pull/11446#discussion_r766860629). With this approach we can have single schema to populate.
631
+
## Unresolved Questions
620
632
621
633
* Donnie: When I want to create archival records, will I want something more unique than the project name?
622
634
Adding the path, repo, commit ID, etc seems complex. [r766920783](https://github.com/NuGet/Home/pull/11446#discussion_r766920783)
In other words, if I look at this output years from now, how would I know whether any transitives were in this project? [r766924390](https://github.com/NuGet/Home/pull/11446#discussion_r766924390)
627
639
* packages.lock.json format could be used here.
628
640
629
-
* Loïc : Should `dotnet list package` include hashes or package source for each dependency? The package ID and version isn't globally unique across package sources?
630
-
* If we re-sign package then hash changes?
631
-
* Related to above: `dotnet list package --outdated`output include `The following sources were used:`, but `dotnet list package` doesn't. Should we make them same?
632
-
* Loïc : Should we include some sort of hash or package source used to restore the package? A package ID and version may have different content across different package sources. In other words, the package ID + version does not actually capture which package your project depends on. [r767030495](https://github.com/NuGet/Home/pull/11446#discussion_r767030495)
633
641
* Loïc : How would this format evolve if we add another "package pivot" in addition to top level and transitive packages? For example, what if we add new package kinds for source generators, Roslyn analyzers, etc...? [r767026799](https://github.com/NuGet/Home/pull/11446#discussion_r767026799)
634
642
643
+
>> Out of scope from MVP, this schema can evolve over time, by the time we have necessity to do change we can make more educated decision.
644
+
635
645
* Could we use existing packages.lock.json format? [sample](https://gist.github.com/erdembayar/4894b66bde227147b60e60997d20df41)
636
646
* Direct/top level packages point to dependency packages.
637
-
* Content hash.
647
+
* Content hash. >> out of scope for now. Tracking issue https://github.com/NuGet/Home/issues/11552
648
+
649
+
## Future Possibilities
650
+
651
+
* Show resolution tree for transitive dependencies and constraint for dependency [resolved version](https://github.com/NuGet/Home/pull/11446/files#r777233006), tracking issue: https://github.com/NuGet/Home/issues/11553
652
+
653
+
* Return different exit codes if any vulnerabilities, deprecations, outdated package is [detected](https://github.com/NuGet/Home/blob/dotnet-audit/proposed/2021/DotNetAudit.md#dotnet-audit-exit-codes).
654
+
655
+
*`--all` option for dotnet list package [r766860629](https://github.com/NuGet/Home/pull/11446#discussion_r766860629), tracking issue https://github.com/NuGet/Home/issues/11551
656
+
657
+
* Include-transitive dependencies by default [r766924390](https://github.com/NuGet/Home/pull/11446#discussion_r766924390), tracking issue https://github.com/NuGet/Home/issues/11550
658
+
659
+
* Include hash + source for package, because same package ID+version might have different hash. It can be used to detect [dependency confusion attack](https://github.com/NuGet/Home/pull/11446#discussion_r767030495), tracking issue: https://github.com/NuGet/Home/issues/11552
0 commit comments