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 Mar 5, 2026
Conversation
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
jjonescz
reviewed
Mar 3, 2026
src/Microsoft.CodeAnalysis.NetAnalyzers/src/Microsoft.CodeAnalysis.NetAnalyzers.sarif
Show resolved
Hide resolved
…space in spread syntax Co-authored-by: jjonescz <3669664+jjonescz@users.noreply.github.com>
jjonescz
approved these changes
Mar 3, 2026
Contributor
There was a problem hiding this comment.
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 frompacks/Microsoft.NETCore.App.Ref/<version>/data/FrameworkList.xml. - Replace ~167 hard-coded
/reference:arguments inCSharpCompilerCommand.Generated.cswith a spread ofGetFrameworkReferenceArguments(). - Update
RunFileTests.CscArgumentsgeneration + 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(). |
333fred
approved these changes
Mar 3, 2026
RikkiGibson
approved these changes
Mar 3, 2026
…orkAnalyzerArguments Co-authored-by: jjonescz <3669664+jjonescz@users.noreply.github.com>
…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
jjonescz
reviewed
Mar 3, 2026
…to shared GetFrameworkArguments helper Co-authored-by: jjonescz <3669664+jjonescz@users.noreply.github.com>
RikkiGibson
approved these changes
Mar 3, 2026
RikkiGibson
reviewed
Mar 3, 2026
Member
|
@MiYanni for a review, thanks |
MiYanni
approved these changes
Mar 5, 2026
This was referenced Mar 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GetFrameworkReferenceArguments()method toCSharpCompilerCommand.csCSharpCompilerCommand.Generated.csto replace 167 hard-coded/reference:lines with.. GetFrameworkReferenceArguments()CscArgumentsinRunFileTests.csto emit.. GetFrameworkReferenceArguments()Microsoft.CodeAnalysis.NetAnalyzers.sarif.. GetFrameworkReferenceArguments())using System.Xml.Linq;(already a global using via Directory.Build.props)GetFrameworkAnalyzerArguments()and replace 6 hard-coded targeting-pack/analyzer:linesGetFrameworkArguments(type, language, argPrefix)helper to eliminate code duplicationCscArgumentstest passesOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.