Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Sep 3, 2025

Fixes #50614

  • Implement SelectRuntimeIdentifierSpecificItems MSBuild task
  • Add comprehensive unit tests for the task
  • Add UsingTask declaration to make task ambiently available to downstream consumers
  • Remove #nullable disable directive and add proper nullable reference type annotations
  • Simplify runtime compatibility check to use runtimeGraph.AreCompatible() directly
  • Update nullable annotations for Required properties to use null! pattern

💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@baronfel note: I've reviewed and tested this PR and am happy with its semantics and coverage.

@Copilot Copilot AI changed the title [WIP] [New MSBuild Task] Allow filtering a set of Items by matching on compatible RuntimeIdentifier Add SelectRuntimeIdentifierSpecificItems MSBuild task for filtering items by compatible RuntimeIdentifier Sep 3, 2025
Copilot finished work on behalf of baronfel September 3, 2025 21:03
@Copilot Copilot AI requested a review from baronfel September 3, 2025 21:03
… Microsoft.NET.RuntimeIdentifierInference.targets

Co-authored-by: baronfel <[email protected]>
Copy link
Contributor Author

Copilot AI commented Sep 3, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@Copilot Copilot AI requested a review from baronfel September 3, 2025 21:33
Copilot finished work on behalf of baronfel September 3, 2025 21:33
Copilot finished work on behalf of baronfel September 3, 2025 22:06
@Copilot Copilot AI requested a review from baronfel September 3, 2025 22:06
@baronfel baronfel marked this pull request as ready for review September 3, 2025 22:16
@Copilot Copilot AI review requested due to automatic review settings September 3, 2025 22:16
Copy link
Contributor

@Copilot 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 introduces a new MSBuild task SelectRuntimeIdentifierSpecificItems that filters items based on Runtime Identifier compatibility using NuGet's runtime graph. The task enables downstream consumers to filter assets by RID compatibility rather than just equality, supporting container incrementality scenarios.

  • Implements the core task with proper nullable reference type annotations
  • Adds comprehensive unit tests covering compatibility filtering, exact matches, and edge cases
  • Makes the task ambiently available through UsingTask declaration in targets file

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
Microsoft.NET.RuntimeIdentifierInference.targets Adds UsingTask declaration to make the new task available to consumers
SelectRuntimeIdentifierSpecificItems.cs Implements the main task logic with RID compatibility filtering using RuntimeGraph
GivenASelectRuntimeIdentifierSpecificItems.cs Provides comprehensive unit test coverage for all task scenarios

Comment on lines 39 to 40
[Required]
public string? RuntimeIdentifierGraphPath { get; set; }
Copy link
Preview

Copilot AI Sep 3, 2025

Choose a reason for hiding this comment

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

Properties marked with [Required] should not be nullable. The MSBuild framework expects required properties to have non-null values, making the nullable annotation misleading and potentially causing confusion for consumers.

Suggested change
[Required]
public string? RuntimeIdentifierGraphPath { get; set; }
public string RuntimeIdentifierGraphPath { get; set; }

Copilot uses AI. Check for mistakes.

@Copilot Copilot AI requested a review from baronfel September 3, 2025 22:25
Copilot finished work on behalf of baronfel September 3, 2025 22:25
Copilot finished work on behalf of baronfel September 3, 2025 22:41
@Copilot Copilot AI requested a review from baronfel September 3, 2025 22:41
@baronfel baronfel enabled auto-merge (squash) September 16, 2025 20:58
@baronfel
Copy link
Member

/backport to release/10.0.1xx

Copy link
Contributor

Started backporting to release/10.0.1xx: https://github.com/dotnet/sdk/actions/runs/17780051830

@baronfel baronfel merged commit 77050e3 into main Sep 17, 2025
27 checks passed
@baronfel baronfel deleted the copilot/fix-50614 branch September 17, 2025 00:49
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.

[New MSBuild Task] Allow filtering a set of Items by matching on compatible RuntimeIdentifier
3 participants