Skip to content

Add slnf support to dotnet package list #6532

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

Merged
merged 2 commits into from
Jul 10, 2025
Merged

Conversation

zivkan
Copy link
Member

@zivkan zivkan commented Jul 3, 2025

Bug

Fixes: NuGet/Home#11789

Description

dotnet package list reads solution files via an internal helper method, so this change potentially adds support for solution filters to more than just dotnet package list.

The biggest issue is that there is no public API to load and handle solution filters. See NuGet/Home#11789 (comment) for some more details. NuGet.exe supports slnf by using reflection to call a non-public MSBuild API. I'm using this as precedent as something testing and has been working for years. But it's a risk.

Other info:

  • MSBuild's SolutionFile API works with slnx files, so reverted most of the PR that added Microsoft.VisualStudio.SolutionPersistance, since it's no longer needed. This makes a lot of async method into non-async methods. There's a compiler warning about private/internal methods that are async without calling await, and since we treat warnings as errors, it's not optional to deal with them. Hence why there's so much async related changes.
  • XPlat.FuncTests that tests MSBuildAPIUtilityTests uses MSBuild.Locator, and therefore tests that validate slnx loading fail if MSBuild is loaded from earlier than 9.0.300, so I bumped our repo's min SDK version to that.

PR Checklist

  • Meaningful title, helpful description and a linked NuGet/Home issue
  • Added tests
  • Link to an issue or pull request to update docs if this PR changes settings, environment variables, new feature, etc. the docs on dotnet package list doesn't mention solution filters or slnf, so I don't think any docs need to change.

@zivkan zivkan requested a review from a team as a code owner July 3, 2025 00:10
@zivkan zivkan requested review from nkolev92 and donnie-msft July 3, 2025 00:10
nkolev92
nkolev92 previously approved these changes Jul 3, 2025
@zivkan
Copy link
Member Author

zivkan commented Jul 3, 2025

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

donnie-msft
donnie-msft previously approved these changes Jul 3, 2025
Copy link
Contributor

@donnie-msft donnie-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the docs on dotnet package list doesn't mention solution filters or slnf, so I don't think any docs need to change.

What about adding something like my bolded words here to the argument definition?

The project, solution file, or solution filter (slnf) to operate on. If not specified, the command searches the current directory for one. If more than one solution or project is found, an error is thrown.

@zivkan zivkan dismissed stale reviews from donnie-msft and nkolev92 via af2d905 July 5, 2025 01:02
@zivkan zivkan force-pushed the dev-zivkan-dotnet-list-slnf branch from af2d905 to 873c318 Compare July 8, 2025 22:13
@zivkan zivkan force-pushed the dev-zivkan-dotnet-list-slnf branch from 873c318 to 99c7505 Compare July 9, 2025 19:57
@zivkan zivkan merged commit c21ba3b into dev Jul 10, 2025
17 of 18 checks passed
@zivkan zivkan deleted the dev-zivkan-dotnet-list-slnf branch July 10, 2025 00:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: dotnet list [project | solution] package does not work with solution filters
3 participants