fix(mcp): report correct TargetFramework for net10.0 projects - #20
Merged
Conversation
get_project_graph fell back to preprocessor symbols when the TFM was inherited from Directory.Build.props, and picked the longest NET-prefixed symbol. For net10.0 that is NETCOREAPP1_0_OR_GREATER (24 chars beats NET10_0_OR_GREATER's 18), which after stripping _OR_GREATER misreported as "netcoreapp1.0". Match only exact TFM symbols (NET10_0, NETSTANDARD2_0, NETCOREAPP3_1) with anchored regexes so *_OR_GREATER compat symbols can never win, and fall back to underscore-less .NET Framework symbols (NET48, NET472). Fixes #19 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Ships the TargetFramework detection fix for #19. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Fixes #19
Root cause
get_project_graphfalls back to preprocessor symbols when the TFM is inherited fromDirectory.Build.props(so the.csprojparse finds nothing). The fallback picked the longestNET*-prefixed symbol — for a net10.0 compilation that's the compat symbolNETCOREAPP1_0_OR_GREATER(24 chars beatsNET10_0_OR_GREATER's 18). Stripping_OR_GREATERand lowercasing producednetcoreapp1.0. net8.0/net9.0 misreport identically.Fix
The fallback now matches only exact TFM symbols with anchored regexes (
NET10_0,NETSTANDARD2_0,NETCOREAPP3_1), picks the highest version, and handles underscore-less .NET Framework symbols (NET48→net48).*_OR_GREATERcompat symbols can never match.Changes
GetProjectGraphTool.cs— symbol-selection logic extracted to an internal, testable method with the corrected matchingnetcoreapp1.0from the issue)InternalsVisibleTofor the test assemblyVerification
netcoreapp1.0), green afterdotnet format --verify-no-changesclean on changed files🤖 Generated with Claude Code