Skip to content

File-based apps: improve legacy artifact support - #56160

Merged
jjonescz merged 2 commits into
dotnet:mainfrom
jjonescz:sprint-reuse-artifacts-net10-2
Sep 11, 2026
Merged

File-based apps: improve legacy artifact support#56160
jjonescz merged 2 commits into
dotnet:mainfrom
jjonescz:sprint-reuse-artifacts-net10-2

Conversation

@jjonescz

@jjonescz jjonescz commented Sep 8, 2026

Copy link
Copy Markdown
Member

A better version of #55970.
Should fix the issue reported in dotnet/vscode-csharp#9734 (comment).
See roslyn counterpart for more details: dotnet/roslyn#85204

@jjonescz jjonescz added the Area-run-file Items related to the "dotnet run <file>" effort label Sep 8, 2026
@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.

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.

🟡 Changes recommended

The test overrides the capability in every case, leaving the newly declared SDK capability contract untested.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Improves file-based app artifact compatibility when hosts evaluate projects with older SDKs.

Changes:

  • Adds an SDK capability marker for file-based artifact paths.
  • Uses capability detection to select modern or legacy artifact output.
  • Updates compatibility tests for both paths.
File summaries
File Description
Microsoft.NET.DefaultArtifactsPath.props Declares artifact-path capability.
VirtualProjectBuilder.cs Selects output behavior from capability.
RunFileTests_CscOnlyAndApi.cs Tests capability-based selection.
Review details

Suppressed comments (1)

src/Cli/Microsoft.DotNet.FileBasedPrograms/VirtualProjectBuilder.cs:512

  • The preceding comment still describes the removed “props imported but no layout selected” condition. The new logic deliberately chooses legacy output whenever the evaluated SDK lacks the capability, including when an older SDK selected an explicit artifacts layout, so the comment now contradicts the behavior it explains.
                _useLegacyArtifactsPath = !string.Equals(defaultArtifactsPathPropsImported, bool.TrueString, StringComparison.OrdinalIgnoreCase);
  • Files reviewed: 3/3 changed files
  • Comments generated: 2
  • Review effort level: Balanced

Comment thread test/dotnet.Tests/CommandTests/Run/RunFileTests_CscOnlyAndApi.cs
Comment thread src/Cli/Microsoft.DotNet.FileBasedPrograms/VirtualProjectBuilder.cs Outdated
@jjonescz
jjonescz marked this pull request as ready for review September 8, 2026 14:57
@jjonescz
jjonescz requested review from a team as code owners September 8, 2026 14:57
@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.

@jjonescz

Copy link
Copy Markdown
Member Author

@333fred @RikkiGibson for reviews, thanks

@jjonescz
jjonescz merged commit b0c8492 into dotnet:main Sep 11, 2026
24 checks passed
@jjonescz
jjonescz deleted the sprint-reuse-artifacts-net10-2 branch September 11, 2026 08:55
@jjonescz

Copy link
Copy Markdown
Member Author

/backport to release/11.0.1xx

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/11.0.1xx (link to workflow run)

@github-actions

Copy link
Copy Markdown
Contributor

@jjonescz backporting to release/11.0.1xx failed, the patch most likely resulted in conflicts. Please backport manually!

git am output
$ git cherry-pick b0c84929bad3f1c10d5b9888b46f3ac2dc1db02a

Auto-merging src/Cli/Microsoft.DotNet.FileBasedPrograms/VirtualProjectBuilder.cs
CONFLICT (content): Merge conflict in src/Cli/Microsoft.DotNet.FileBasedPrograms/VirtualProjectBuilder.cs
Auto-merging test/dotnet.Tests/CommandTests/Run/RunFileTests_CscOnlyAndApi.cs
CONFLICT (content): Merge conflict in test/dotnet.Tests/CommandTests/Run/RunFileTests_CscOnlyAndApi.cs
error: could not apply b0c84929ba... File-based apps: improve legacy artifact support (#56160)
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".
hint: Disable this message with "git config set advice.mergeConflict false"


$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch

Applying: File-based apps: improve legacy artifact support
Using index info to reconstruct a base tree...
M	src/Cli/Microsoft.DotNet.FileBasedPrograms/VirtualProjectBuilder.cs
M	test/dotnet.Tests/CommandTests/Run/RunFileTests_CscOnlyAndApi.cs
Falling back to patching base and 3-way merge...
Auto-merging src/Cli/Microsoft.DotNet.FileBasedPrograms/VirtualProjectBuilder.cs
CONFLICT (content): Merge conflict in src/Cli/Microsoft.DotNet.FileBasedPrograms/VirtualProjectBuilder.cs
Auto-merging test/dotnet.Tests/CommandTests/Run/RunFileTests_CscOnlyAndApi.cs
CONFLICT (content): Merge conflict in test/dotnet.Tests/CommandTests/Run/RunFileTests_CscOnlyAndApi.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 0001 File-based apps: improve legacy artifact support
Error: The process '/usr/bin/git' failed with exit code 128

Link to workflow output

@jjonescz

Copy link
Copy Markdown
Member Author

/backport to release/11.0.1xx

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/11.0.1xx (link to workflow run)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-run-file Items related to the "dotnet run <file>" effort

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants