[Breaking change] DefineConstants for target frameworks not available at evaluation time#52279
Open
[Breaking change] DefineConstants for target frameworks not available at evaluation time#52279
DefineConstants for target frameworks not available at evaluation time#52279Conversation
Contributor
|
@copilot please try again |
…t available at evaluation time Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
Contributor
Author
Copilot
AI
changed the title
[WIP] [Breaking change] Fix DefineConstants items for evaluation-time usage
[Breaking change] Mar 12, 2026
DefineConstants for target frameworks not available at evaluation time
gewarren
approved these changes
Mar 13, 2026
docs/core/compatibility/sdk/10.0/defineconstants-not-available-at-evaluation.md
Outdated
Show resolved
Hide resolved
docs/core/compatibility/sdk/10.0/defineconstants-not-available-at-evaluation.md
Outdated
Show resolved
Hide resolved
docs/core/compatibility/sdk/10.0/defineconstants-not-available-at-evaluation.md
Outdated
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new .NET 10 SDK breaking change article documenting that the SDK-injected TFM-related values in DefineConstants are no longer available during MSBuild evaluation, and updates the compatibility index pages to include it.
Changes:
- Adds a new breaking change article describing the evaluation-time behavior change and migration guidance.
- Updates the .NET 10 compatibility index table to include the new breaking change.
- Adds the new article to the compatibility TOC under .NET 10 > SDK and MSBuild.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| docs/core/compatibility/toc.yml | Adds the new breaking change article to the TOC. |
| docs/core/compatibility/sdk/10.0/defineconstants-not-available-at-evaluation.md | New breaking change article explaining the change and recommended migration pattern. |
| docs/core/compatibility/10.md | Adds a new row in the .NET 10 breaking changes table referencing the article. |
You can also share your feedback on Copilot code review. Take the survey.
docs/core/compatibility/sdk/10.0/defineconstants-not-available-at-evaluation.md
Show resolved
Hide resolved
docs/core/compatibility/sdk/10.0/defineconstants-not-available-at-evaluation.md
Outdated
Show resolved
Hide resolved
docs/core/compatibility/sdk/10.0/defineconstants-not-available-at-evaluation.md
Outdated
Show resolved
Hide resolved
docs/core/compatibility/sdk/10.0/defineconstants-not-available-at-evaluation.md
Show resolved
Hide resolved
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.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.
Adds a new breaking change article documenting that TFM-related
DefineConstantsvalues (such asNET9_0_OR_GREATER,NETSTANDARD2_0, and similar) are no longer computed at MSBuild evaluation time in .NET 10. Project fileConditionattributes that inspect these values now silently evaluate against empty strings.Changes
docs/core/compatibility/sdk/10.0/defineconstants-not-available-at-evaluation.mdcovering previous/new behavior, reason for change, and migration guidancedocs/core/compatibility/toc.ymlunder .NET 10 > SDK and MSBuilddocs/core/compatibility/10.mdMigration pattern
User-defined
DefineConstantsvalues are unaffected; only the SDK-injected TFM constants moved to target-execution time.Original prompt
DefineConstantsitems for target frameworks are no longer available at evaluation-time #51763💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.
Internal previews
DefineConstantsfor target frameworks not available at evaluation time