Skip to content

Replace Reference/PackageDependencies feature checks with ReferencePath filename checks#87

Merged
Tyrrrz merged 2 commits intomasterfrom
copilot/replace-dependency-checks-in-targets
Mar 2, 2026
Merged

Replace Reference/PackageDependencies feature checks with ReferencePath filename checks#87
Tyrrrz merged 2 commits intomasterfrom
copilot/replace-dependency-checks-in-targets

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 2, 2026

The .targets file was using two MSBuild item group checks per assembly (Reference + PackageDependencies by Identity) to detect whether a dependency is present. This replaces both with a single ReferencePath check by Filename metadata.

Closes #88

Changes

  • PolyShim/PolyShim.targets: For every feature, removed the paired Reference/PackageDependencies identity checks and replaced with a single ReferencePath filename check:
<!-- Before (two conditions per assembly) -->
<FeatureArrayPool
  Condition="@(Reference-&gt;AnyHaveMetadataValue('Identity', 'System.Buffers'))"
  >true</FeatureArrayPool>
<FeatureArrayPool
  Condition="@(PackageDependencies-&gt;AnyHaveMetadataValue('Identity', 'System.Buffers'))"
  >true</FeatureArrayPool>

<!-- After (single condition) -->
<FeatureArrayPool
  Condition="@(ReferencePath-&gt;AnyHaveMetadataValue('Filename', 'System.Buffers'))"
  >true</FeatureArrayPool>

Features that previously checked two assemblies (e.g. FeatureHashCode checking both System.HashCode and Microsoft.Bcl.HashCode, FeatureHttpClient, FeatureTask) retain two conditions — one per assembly — but each now uses ReferencePath/Filename rather than the old pair pattern.


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

@Tyrrrz Tyrrrz added the bug Something isn't working label Mar 2, 2026
…s in PolyShim.targets

Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
Copilot AI changed the title [WIP] Replace project dependency checks in .targets file Replace Reference/PackageDependencies feature checks with ReferencePath filename checks Mar 2, 2026
@Tyrrrz
Copy link
Copy Markdown
Owner

Tyrrrz commented Mar 2, 2026

@copilot closes #88

@Tyrrrz Tyrrrz marked this pull request as ready for review March 2, 2026 10:41
Copilot AI review requested due to automatic review settings March 2, 2026 10:41
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.31%. Comparing base (468caa7) to head (90d89c1).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #87      +/-   ##
==========================================
- Coverage   85.37%   85.31%   -0.06%     
==========================================
  Files         220      220              
  Lines        3603     3603              
  Branches      314      314              
==========================================
- Hits         3076     3074       -2     
- Misses        455      457       +2     
  Partials       72       72              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
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

Updates PolyShim’s MSBuild feature-detection logic to use resolved references rather than separate Reference + PackageDependencies identity checks, simplifying how feature flags are determined during the build.

Changes:

  • Replaced paired @(Reference) / @(PackageDependencies) Identity checks with a single @(ReferencePath) Filename check per dependency.
  • Kept multi-assembly feature detection (e.g., HashCode/HttpClient/Task) as multiple conditions, but migrated each to the new ReferencePath approach.

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

@Tyrrrz Tyrrrz merged commit 6995a56 into master Mar 2, 2026
10 checks passed
@Tyrrrz Tyrrrz deleted the copilot/replace-dependency-checks-in-targets branch March 2, 2026 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compatibility packages dependency checks sometimes report false positives

3 participants