Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@nkolev92
Copy link
Contributor

VMR version of dotnet/msbuild#12932

Copilot AI review requested due to automatic review settings December 16, 2025 17:27
@dotnet-policy-service dotnet-policy-service bot requested a review from a team December 16, 2025 17:28
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 adds support for a new CurrentProjectTargetFrameworkProperty parameter to the GetReferenceNearestTargetFrameworkTask, maintaining backward compatibility with older NuGet versions. The change introduces a conditional invocation strategy where the task is called with the new parameter when supported, or falls back to the previous behavior when not supported.

  • Adds CurrentProjectTargetFrameworkProperty parameter to pass $(TargetFramework) value
  • Introduces gating logic based on GetReferenceNearestTargetFrameworkTaskSupportsTargetFrameworkPropertyParameter property
  • Duplicates the task invocation to handle both new and legacy NuGet versions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

<Output ItemName="AnnotatedProjects" TaskParameter="AssignedProjects" />
</GetReferenceNearestTargetFrameworkTask>

<!-- Pass the CurrentProjectTargetPlatform parameter to the task only if GetReferenceNearestTargetFrameworkTaskSupportsTargetPlatformParameter is true and GetReferenceNearestTargetFrameworkTaskSupportsTargetFrameworkPropertyParameter is not true. This means
Copy link

Copilot AI Dec 16, 2025

Choose a reason for hiding this comment

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

The comment incorrectly states 'Pass the CurrentProjectTargetPlatform parameter' when it should describe the purpose of this second task invocation as a fallback for older NuGet versions that don't support the new CurrentProjectTargetFrameworkProperty parameter. The comment should clarify this is for backward compatibility.

Copilot uses AI. Check for mistakes.
<GetReferenceNearestTargetFrameworkTask AnnotatedProjectReferences="@(_ProjectReferenceTargetFrameworkPossibilities)"
CurrentProjectTargetFramework="$(ReferringTargetFrameworkForProjectReferences)"
CurrentProjectTargetPlatform="$(TargetPlatformMoniker)"
CurrentProjectTargetFrameworkProperty="$(TargetFramework)"
Copy link

Copilot AI Dec 16, 2025

Choose a reason for hiding this comment

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

The new parameter is only added to the first task invocation (lines 1889-1898) but not to the fallback invocation (lines 1903-1911). While this appears intentional for backward compatibility, there's duplicate task logic that could be error-prone during future maintenance. Consider adding a comment explaining why this parameter is omitted in the second invocation.

Copilot uses AI. Check for mistakes.
@nkolev92 nkolev92 closed this Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants