Skip to content

Use FrameworkList.xml instead of hard-coding references and analyzers in optimized CSC-only file-based app builds#53205

Merged
jjonescz merged 7 commits intorelease/10.0.3xxfrom
copilot/use-frameworklist-xml
Mar 5, 2026
Merged

Use FrameworkList.xml instead of hard-coding references and analyzers in optimized CSC-only file-based app builds#53205
jjonescz merged 7 commits intorelease/10.0.3xxfrom
copilot/use-frameworklist-xml

Conversation

Copy link
Contributor

Copilot AI commented Mar 1, 2026

  • Add GetFrameworkReferenceArguments() method to CSharpCompilerCommand.cs
  • Update CSharpCompilerCommand.Generated.cs to replace 167 hard-coded /reference: lines with .. GetFrameworkReferenceArguments()
  • Update the test CscArguments in RunFileTests.cs to emit .. GetFrameworkReferenceArguments()
  • Address review: restore trailing newline in Microsoft.CodeAnalysis.NetAnalyzers.sarif
  • Address review: format spread with a space (.. GetFrameworkReferenceArguments())
  • Address review: remove redundant using System.Xml.Linq; (already a global using via Directory.Build.props)
  • Address review: add GetFrameworkAnalyzerArguments() and replace 6 hard-coded targeting-pack /analyzer: lines
  • Address review comment 2879241632: merge both methods into a shared GetFrameworkArguments(type, language, argPrefix) helper to eliminate code duplication
  • Verify the build succeeds and CscArguments test passes
Original prompt

This section details on the original issue you should resolve

<issue_title>Use FrameworkList.xml instead of hard-coding references in optimized CSC-only file-based app builds</issue_title>
<issue_description>See also #52727 (comment).
Related to #49528 (comment).</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits March 1, 2026 15:35
Co-authored-by: jjonescz <3669664+jjonescz@users.noreply.github.com>
…le-based app builds

Replace 167 hard-coded /reference: lines in CSharpCompilerCommand.Generated.cs
with a dynamic GetFrameworkReferenceArguments() method that reads FrameworkList.xml
from the current targeting pack at runtime.

Co-authored-by: jjonescz <3669664+jjonescz@users.noreply.github.com>
Copilot AI changed the title [WIP] Update app builds to use FrameworkList.xml instead of hard-coded references Use FrameworkList.xml instead of hard-coding references in optimized CSC-only file-based app builds Mar 1, 2026
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.

…space in spread syntax

Co-authored-by: jjonescz <3669664+jjonescz@users.noreply.github.com>
@jjonescz jjonescz added the Area-run-file Items related to the "dotnet run <file>" effort label Mar 3, 2026
@jjonescz jjonescz marked this pull request as ready for review March 3, 2026 01:11
@jjonescz jjonescz requested review from a team and Copilot March 3, 2026 01:11
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 removes hard-coded framework reference arguments from the optimized CSC-only dotnet run file.cs path by reading them dynamically from FrameworkList.xml, keeping the generated argument list in sync with the installed targeting pack.

Changes:

  • Add GetFrameworkReferenceArguments() to read framework references from packs/Microsoft.NETCore.App.Ref/<version>/data/FrameworkList.xml.
  • Replace ~167 hard-coded /reference: arguments in CSharpCompilerCommand.Generated.cs with a spread of GetFrameworkReferenceArguments().
  • Update RunFileTests.CscArguments generation + assertions to account for dynamic reference ordering and ensure references are present.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
test/dotnet.Tests/CommandTests/Run/RunFileTests.cs Updates generator + assertions to tolerate reference ordering differences and validate reference presence.
src/Cli/dotnet/Commands/Run/CSharpCompilerCommand.cs Adds FrameworkList.xml reader that yields /reference: arguments.
src/Cli/dotnet/Commands/Run/CSharpCompilerCommand.Generated.cs Replaces hard-coded framework reference list with .. GetFrameworkReferenceArguments().

…orkAnalyzerArguments

Co-authored-by: jjonescz <3669664+jjonescz@users.noreply.github.com>
Copilot AI requested a review from a team as a code owner March 3, 2026 15:05
…ting-pack analyzers

Co-authored-by: jjonescz <3669664+jjonescz@users.noreply.github.com>
Copilot AI changed the title Use FrameworkList.xml instead of hard-coding references in optimized CSC-only file-based app builds Use FrameworkList.xml instead of hard-coding references and analyzers in optimized CSC-only file-based app builds Mar 3, 2026
…to shared GetFrameworkArguments helper

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

jjonescz commented Mar 5, 2026

@MiYanni for a review, thanks

@jjonescz jjonescz merged commit 94a9db1 into release/10.0.3xx Mar 5, 2026
28 checks passed
@jjonescz jjonescz deleted the copilot/use-frameworklist-xml branch March 5, 2026 22:23
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