Skip to content

Ensure csc.rsp is always written to disk with dotnet run and dotnet build#53235

Merged
jjonescz merged 10 commits intorelease/10.0.3xxfrom
copilot/ensure-csc-rsp-always-generated
Mar 10, 2026
Merged

Ensure csc.rsp is always written to disk with dotnet run and dotnet build#53235
jjonescz merged 10 commits intorelease/10.0.3xxfrom
copilot/ensure-csc-rsp-always-generated

Conversation

Copy link
Contributor

Copilot AI commented Mar 3, 2026

  • Write csc.rsp after MSBuild builds (both dotnet run file.cs and dotnet build file.cs)
  • Refactor WriteCscRspFile / GetCscRspPath into CSharpCompilerCommand as shared helpers
  • Fix Builder.RequestedTargets empty-array bug with is { Length: > 0 } check
  • Add SkipNonexistentTargets flag so multi-target outer builds (no CoreCompile) don't fail
  • Add MSBuild_WritesCscRsp and DotnetBuild_WritesCscRsp tests
  • All related tests pass (Build_Library_MultiTarget, Build_Exe_MultiTarget, new csc.rsp tests)

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits March 3, 2026 18:42
Co-authored-by: jjonescz <3669664+jjonescz@users.noreply.github.com>
…ckly

Co-authored-by: jjonescz <3669664+jjonescz@users.noreply.github.com>
Copy link
Member

@jjonescz jjonescz left a comment

Choose a reason for hiding this comment

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

…hange

Co-authored-by: jjonescz <3669664+jjonescz@users.noreply.github.com>
Copy link
Member

@jjonescz jjonescz left a comment

Choose a reason for hiding this comment

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

@copilot please address feedback and also consider updating PR title/description which seems to be in a stale state since some previous iteration of copilot failed

…ublic API

Co-authored-by: jjonescz <3669664+jjonescz@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 3, 2026

@copilot please address feedback and also consider updating PR title/description which seems to be in a stale state since some previous iteration of copilot failed

Addressed in commit e0956ef. PR description has also been updated to reflect the current state.

Copilot AI changed the title [WIP] Ensure csc.rsp is always written to disk with dotnet run Ensure csc.rsp is always written to disk with dotnet run Mar 3, 2026
@jjonescz jjonescz added the Area-run-file Items related to the "dotnet run <file>" effort label Mar 4, 2026
@jjonescz jjonescz marked this pull request as ready for review March 4, 2026 00:51
@jjonescz jjonescz requested review from a team and Copilot March 4, 2026 00:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR ensures dotnet run <file>.cs produces a csc.rsp on disk even when the build goes through the full MSBuild path, enabling IDEs to consume compiler arguments for faster virtual project setup (per the Roslyn issue).

Changes:

  • Write csc.rsp after successful MSBuild builds by persisting cached CSC arguments.
  • Factor csc.rsp writing/path logic into a shared helper (WriteCscRspFile / GetCscRspPath).
  • Add a test verifying csc.rsp exists and is non-empty after an MSBuild build.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
test/dotnet.Tests/CommandTests/Run/RunFileTests.cs Adds coverage asserting csc.rsp is created after a full MSBuild build.
src/Cli/dotnet/Commands/Run/VirtualProjectBuildingCommand.cs Writes csc.rsp after MSBuild builds using cached CSC arguments.
src/Cli/dotnet/Commands/Run/CSharpCompilerCommand.cs Introduces shared helper to write csc.rsp and centralizes rsp path construction.

…esCscRsp test

Co-authored-by: jjonescz <3669664+jjonescz@users.noreply.github.com>
Copilot AI changed the title Ensure csc.rsp is always written to disk with dotnet run Ensure csc.rsp is always written to disk with dotnet run and dotnet build Mar 4, 2026
… when no targets specified

Co-authored-by: jjonescz <3669664+jjonescz@users.noreply.github.com>
@jjonescz jjonescz marked this pull request as draft March 4, 2026 23:19
…s for CoreCompile

Co-authored-by: jjonescz <3669664+jjonescz@users.noreply.github.com>
@jjonescz jjonescz marked this pull request as ready for review March 5, 2026 17:19
@jjonescz jjonescz requested a review from a team as a code owner March 5, 2026 17:19
@jjonescz jjonescz requested review from 333fred and MiYanni March 5, 2026 17:19
jjonescz and others added 2 commits March 10, 2026 10:18
Co-authored-by: Fred Silberberg <frsilb@microsoft.com>
@jjonescz
Copy link
Member

@MiYanni for a review, thanks

@jjonescz jjonescz merged commit c40f47f into release/10.0.3xx Mar 10, 2026
28 checks passed
@jjonescz jjonescz deleted the copilot/ensure-csc-rsp-always-generated branch March 10, 2026 20:11
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.

6 participants