Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 4, 2025

The documentation incorrectly stated that TargetFrameworks (plural) is ignored when TargetFramework (singular) is specified. The actual behavior is the opposite.

Changes

  • Updated the Note in the TargetFrameworks section to correctly state: "If TargetFrameworks (plural) is specified, TargetFramework (singular) is ignored."

Context

When both properties are present in a project file:

<PropertyGroup>
  <TargetFramework>net8.0</TargetFramework>
  <TargetFrameworks>net7.0;net6.0</TargetFrameworks>
</PropertyGroup>

MSBuild uses TargetFrameworks and ignores TargetFramework, regardless of declaration order.

Original prompt

This section details on the original issue you should resolve

<issue_title>[UUF] - TargetFramework ignored if TargetFrameworks specified</issue_title>
<issue_description>### Type of issue

Outdated article

Description

The Note for TargetFrameworks is wrong, the current behavior in Visual Studio 2022 is that when TargetFrameworks, plural, is defined, then TargetFramework (singular) is ignored.

Page URL

https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props

Content source URL

https://github.com/dotnet/docs/blob/main/docs/core/project-sdk/msbuild-props.md

Document Version Independent Id

6741b1de-38a4-fbb1-d79d-acc47d549a2d

Platform Id

eeaf76f8-da20-9011-c5e7-db6166523403

Article author

@gewarren

Metadata

  • ID: cb4428fc-215c-78e1-5ff0-fe73f7a08260
  • PlatformId: eeaf76f8-da20-9011-c5e7-db6166523403
  • Service: dotnet-fundamentals

Related Issues</issue_description>

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


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


Internal previews

📄 File 🔗 Preview link
docs/core/project-sdk/msbuild-props.md docs/core/project-sdk/msbuild-props

The note incorrectly stated that TargetFrameworks property is ignored if TargetFramework is specified. The actual behavior is the opposite - when both properties are present, TargetFrameworks (plural) takes precedence and TargetFramework (singular) is ignored.

Updated the note to correctly reflect this behavior.

Fixes #45942

Co-authored-by: gewarren <[email protected]>
Copilot AI changed the title [WIP] Fix misleading note on TargetFrameworks in documentation Fix TargetFrameworks documentation - correct precedence behavior Nov 4, 2025
Copilot finished work on behalf of gewarren November 4, 2025 01:27
Copilot AI requested a review from gewarren November 4, 2025 01:27
Copy link
Contributor

@gewarren gewarren left a comment

Choose a reason for hiding this comment

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

Verified the behavior.

@gewarren gewarren marked this pull request as ready for review November 4, 2025 01:40
@gewarren gewarren requested a review from a team as a code owner November 4, 2025 01:40
Copilot AI review requested due to automatic review settings November 4, 2025 01:40
@gewarren gewarren enabled auto-merge (squash) November 4, 2025 01:41
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 clarifies the documentation for the TargetFrameworks property by reversing the perspective of the note. Instead of stating that TargetFrameworks is ignored when TargetFramework is specified, it now explains that TargetFramework is ignored when TargetFrameworks is present, which better aligns with the property being documented.

Key Changes

  • Rewording of the NOTE section to clarify the relationship between TargetFramework and TargetFrameworks properties.

Copy link
Member

@BillWagner BillWagner left a comment

Choose a reason for hiding this comment

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

This LGTM @gewarren

Let's :shipit:

@gewarren gewarren merged commit 70833c1 into main Nov 4, 2025
22 checks passed
@gewarren gewarren deleted the copilot/fix-targetframeworks-issue branch November 4, 2025 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[UUF] - TargetFramework ignored if TargetFrameworks specified

3 participants