Repository navigation
Add JSON output to dotnet sln list - #56808
Merged
Merged
Conversation
|
Azure Pipelines: Successfully started running 1 pipeline(s). 2 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Co-authored-by: marcpopMSFT <[email protected]>
Copilot
AI
changed the title
[WIP] Add --format option to dotnet sln list command
Add JSON output to dotnet sln list
Oct 27, 2026
3 of 4 tasks
Co-authored-by: Copilot App <[email protected]>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the addition of JSON output to dotnet sln list.
No open issues 🎉
What changed in this PR
Adds machine-readable output to the .NET SDK’s dotnet sln list command, addressing the automation scenario in #26303 while preserving the default table display.
Changes:
- Adds
--format <table|json>with sorted JSON path arrays, including[]for empty solutions. - Uses source-generated JSON serialization and supports solution filters and solution-folder output.
- Updates help, localization entries, schema expectations, and command tests.
| File | Description |
|---|---|
| test/dotnet.Tests/CommandTests/Solution/List/GivenDotnetSlnList.cs | Tests formats, empty solutions, folders, filters, and invalid arguments. |
| test/dotnet.Tests/CliSchemaTests.cs | Updates the expected schema for --format. |
| src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.zh-Hant.xlf | Adds the format-help entry for Traditional Chinese localization. |
| src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.zh-Hans.xlf | Adds the format-help entry for Simplified Chinese localization. |
| src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.tr.xlf | Adds the format-help entry for Turkish localization. |
| src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.ru.xlf | Adds the format-help entry for Russian localization. |
| src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.pt-BR.xlf | Adds the format-help entry for Brazilian Portuguese localization. |
| src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.pl.xlf | Adds the format-help entry for Polish localization. |
| src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.ko.xlf | Adds the format-help entry for Korean localization. |
| src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.ja.xlf | Adds the format-help entry for Japanese localization. |
| src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.it.xlf | Adds the format-help entry for Italian localization. |
| src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.fr.xlf | Adds the format-help entry for French localization. |
| src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.es.xlf | Adds the format-help entry for Spanish localization. |
| src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.de.xlf | Adds the format-help entry for German localization. |
| src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.cs.xlf | Adds the format-help entry for Czech localization. |
| src/Cli/Microsoft.DotNet.Cli.Definitions/Commands/Solution/SolutionListCommandDefinition.cs | Registers format choices and the table default. |
| src/Cli/Microsoft.DotNet.Cli.Definitions/CommandDefinitionStrings.resx | Defines the format option’s help text. |
| src/Cli/dotnet/Commands/Solution/List/SolutionListCommand.cs | Emits sorted JSON arrays using source-generated serialization. |
Review effort: Balanced
marcpopMSFT
temporarily deployed
to
copilot-pat-pool
November 5, 2026 23:10 — with
GitHub Actions
Inactive
Member
|
/backport to release/11.0.2xx |
Contributor
|
Started backporting to |
marcpopMSFT
temporarily deployed
to
copilot-pat-pool
November 5, 2026 23:11 — with
GitHub Actions
Inactive
Contributor
|
@marcpopMSFT backporting to git am output$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch
Creating an empty commit: Initial plan
Applying: Add table and JSON output formats to dotnet sln list
Using index info to reconstruct a base tree...
M src/Cli/Microsoft.DotNet.Cli.Definitions/CommandDefinitionStrings.resx
M src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.cs.xlf
M src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.de.xlf
M src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.es.xlf
M src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.fr.xlf
M src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.it.xlf
M src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.ja.xlf
M src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.ko.xlf
M src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.pl.xlf
M src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.pt-BR.xlf
M src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.ru.xlf
M src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.tr.xlf
M src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.zh-Hans.xlf
M src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.zh-Hant.xlf
M test/dotnet.Tests/CommandTests/Solution/List/GivenDotnetSlnList.cs
Falling back to patching base and 3-way merge...
Auto-merging src/Cli/Microsoft.DotNet.Cli.Definitions/CommandDefinitionStrings.resx
Auto-merging src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.cs.xlf
Auto-merging src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.de.xlf
Auto-merging src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.es.xlf
Auto-merging src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.fr.xlf
Auto-merging src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.it.xlf
Auto-merging src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.ja.xlf
Auto-merging src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.ko.xlf
Auto-merging src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.pl.xlf
Auto-merging src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.pt-BR.xlf
Auto-merging src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.ru.xlf
Auto-merging src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.tr.xlf
Auto-merging src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.zh-Hans.xlf
Auto-merging src/Cli/Microsoft.DotNet.Cli.Definitions/xlf/CommandDefinitionStrings.zh-Hant.xlf
Auto-merging test/dotnet.Tests/CommandTests/Solution/List/GivenDotnetSlnList.cs
CONFLICT (content): Merge conflict in test/dotnet.Tests/CommandTests/Solution/List/GivenDotnetSlnList.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0002 Add table and JSON output formats to dotnet sln list
Error: The process '/usr/bin/git' failed with exit code 128 |
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
dotnet sln listincludes headers that prevent direct consumption by automation. This change adds machine-readable output without changing the default display.Output formats
--format <table|json>, defaulting totable.[]for empty solutions.--solution-folders.CLI integration
dotnet sln source.sln list --format json # ["App/App.csproj","Lib/Lib.csproj"]