Skip to content

[SbrpUsageReport] Fix SBRP detection for packages with versions in their name - #4557

Merged
MichaelSimons merged 2 commits into
dotnet:mainfrom
MichaelSimons:fix-sbrp-manifest-package-detection
Feb 2, 2026
Merged

MichaelSimons merged 2 commits into
dotnet:mainfrom
MichaelSimons:fix-sbrp-manifest-package-detection

Conversation

@MichaelSimons

@MichaelSimons MichaelSimons commented Jan 30, 2026 •

Copy link
Copy Markdown
Member

Read package name and version from nuspec metadata instead of parsing the nupkg filename. This fixes incorrect detection of manifest packages like microsoft.net.sdk.android.manifest-10.0.100 which have version-like strings in their package name.

Before this change, the SbrpUsageReport contained two entries for each of the text-only manifest packages w/the second one being incorrect.

    {
      "Name": "Microsoft.NET.Sdk.Android.Manifest-10.0.100",
      "Version": "36.1.2",
      "Path": "/__w/1/s/src/source-build-reference-packages/src/textOnlyPackages/src/microsoft.net.sdk.android.manifest-10.0.100/36.1.2",
      "Tfms": null,
      "Id": "microsoft.net.sdk.android.manifest-10.0.100/36.1.2",
      "References": {
        "/__w/1/s/src/sdk/artifacts/obj/redist/project.assets.json": []
      }
    },
    {
      "Name": "Microsoft.NET.Sdk.Android.Manifest-10",
      "Version": "0.100.36.1.2",
      "Path": "/__w/1/s/src/source-build-reference-packages/src/externalPackages/src/**/Microsoft.NET.Sdk.Android.Manifest-10/0.100.36.1.2",
      "Tfms": null,
      "Id": "microsoft.net.sdk.android.manifest-10/0.100.36.1.2",
      "References": {}
    },

Copilot AI review requested due to automatic review settings January 30, 2026 16:43
@MichaelSimons
MichaelSimons requested review from a team as code owners January 30, 2026 16:43
@MichaelSimons
MichaelSimons removed the request for review from a team January 30, 2026 16:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 updates the SBRP usage reporting task so that package name and version are derived from nuspec metadata instead of parsing the nupkg filename, fixing mis-detection of packages whose IDs contain version-like segments (e.g., microsoft.net.sdk.android.manifest-10.0.100).

Changes:

  • Add GetPackageInfoFromNupkg helper to open each .nupkg, locate its .nuspec, and read <id> and <version> from the nuspec XML.
  • Update ReadExternalPackages to use nuspec-derived name and version instead of a filename regex, avoiding incorrect splitting for manifest/text-only packages.
  • Introduce System.IO.Compression usage to read .nupkg archives.

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

Read package name and version from nuspec metadata instead of parsing
the nupkg filename. This fixes incorrect detection of manifest packages
like microsoft.net.sdk.android.manifest-10.0.100 which have version-like
strings in their package name.
@MichaelSimons
MichaelSimons force-pushed the fix-sbrp-manifest-package-detection branch from 18d05e2 to c509cd3 Compare January 30, 2026 16:56
@MichaelSimons
MichaelSimons merged commit 1c259bf into dotnet:main Feb 2, 2026
11 checks passed
MichaelSimons added a commit that referenced this pull request Feb 10, 2026
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.

4 participants