Skip to content

Support solution filter (.slnf) inputs in dotnet workload restore - #55599

Merged
marcpopMSFT merged 4 commits into
mainfrom
copilot/improve-workload-restore-support
Oct 2, 2026
Merged

marcpopMSFT merged 4 commits into
mainfrom
copilot/improve-workload-restore-support

Conversation

Copilot AI commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

dotnet workload restore did not accept solution filter inputs, even though solution filters are a standard way to scope project graphs in CI/dev workflows. This change aligns workload restore input handling with restore command behavior for .slnf.

  • Command input handling

    • Extend dotnet workload restore target-path recognition to treat .slnf as a valid solution input.
    • Ensure the solution filter path is forwarded through the existing restore/MSBuild invocation path without altering workload resolution semantics.
  • Consistency with restore command

    • Reuse the same input classification pattern used by dotnet restore so command behavior is consistent across restore surfaces.
    • Preserve existing behavior for .sln/project/directory inputs.
  • Focused test coverage

    • Add/update command-level tests to cover .slnf input acceptance and forwarding for workload restore.
    • Keep coverage scoped to the new input type to avoid broad behavioral changes.

Example (now supported):

dotnet workload restore MyRepo.PlatformA.slnf

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
3 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI linked an issue Aug 4, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Add support for solution filters in workload restore Support solution filter (.slnf) inputs in dotnet workload restore Aug 4, 2026
Copilot AI requested a review from marcpopMSFT August 4, 2026 20:58
@marcpopMSFT

Copy link
Copy Markdown
Member

@copilot I tested and while dotnet workload restore now recognizes .slnf files, it's not correctly figuring out which projects are referenced and what workloads it needs. In my testing, it installed the latest manifests on restore but then didn't actually detect that the project needed wasm-tools. Can you investigate why?

Copilot AI commented Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

@copilot I tested and while dotnet workload restore now recognizes .slnf files, it's not correctly figuring out which projects are referenced and what workloads it needs. In my testing, it installed t...

Fixed in e780fba. The issue was project-path resolution for .slnf: workload restore was resolving filtered project paths relative to the .slnf file location, which is wrong when the filter is in a subfolder. It now resolves .slnf projects relative to the parent solution path, and I added a focused DiscoverAllProjects test covering that subdirectory filter case.

@marcpopMSFT
marcpopMSFT marked this pull request as ready for review September 28, 2026 16:56
@marcpopMSFT
marcpopMSFT requested a review from a team as a code owner September 28, 2026 16:56
Copilot AI lite review requested due to automatic review settings September 28, 2026 16:56
@azure-pipelines

Copy link
Copy Markdown
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.

@marcpopMSFT

Copy link
Copy Markdown
Member

Tested and confirmed running restore on an slnf correctly installed the workload I was expecting. I confirmed it still worked restoring csproj and slnx files and tested the negative that restoring a slnf that didn't require any workloads was a noop. This is good to review.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Add no-argument coverage and exact-set assertions to address the unresolved regression risks.

Review effort: Lite
Findings: 1 Medium severity

Open (1)
What changed in this PR

Adds .slnf support to dotnet workload restore, including filtered project discovery and parent-solution path resolution.

Changes:

  • Recognizes .slnf inputs.
  • Resolves filtered projects correctly.
  • Adds command and discovery tests.
File Summary
test/​dotnet.Tests/​CommandTests/​Workload/​Restore/​GivenDotnetWorkloadRestore.cs Adds command-level .slnf coverage.
test/​dotnet.Tests/​CommandTests/​Workload/​Restore/​DiscoverAllProjectsTests.cs Tests filtered solution project discovery.
src/​Cli/​dotnet/​Commands/​Workload/​Restore/​WorkloadRestoreCommand.cs Adds .slnf discovery and path resolution.

@marcpopMSFT
marcpopMSFT merged commit 1f0d985 into main Oct 2, 2026
23 checks passed
@marcpopMSFT
marcpopMSFT deleted the copilot/improve-workload-restore-support branch October 2, 2026 21:52

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — d1d02b22 Deployed Oct 2, 2026 by marcpopMSFT via pat_pool #7510
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.

Workload restore - support solution filters

4 participants