Skip to content

[xaprepare] Remove NuGet scanning from Step_GenerateCGManifest#11299

Open
jonathanpeppers wants to merge 4 commits intomainfrom
jonathanpeppers/remove-cgmanifest-generation
Open

[xaprepare] Remove NuGet scanning from Step_GenerateCGManifest#11299
jonathanpeppers wants to merge 4 commits intomainfrom
jonathanpeppers/remove-cgmanifest-generation

Conversation

@jonathanpeppers
Copy link
Copy Markdown
Member

@jonathanpeppers jonathanpeppers commented May 6, 2026

Summary

Part of incremental xaprepare removal. Strips Step_GenerateCGManifest down to only git submodule entries.

Details

The Component Governance Azure DevOps extension auto-detects NuGet packages by scanning .csproj files on the build machine. This makes the NuGet scanning in Step_GenerateCGManifest — which parsed every .csproj/.targets/.projitems file for PackageReference elements — completely redundant.

Per the CG manifest documentation, a cgmanifest.json is only needed for component types that CG cannot auto-detect, such as git submodules.

This PR:

  • Removes MSBuildPackageReferenceInfo, CGManifestEntry abstraction, DevelopmentDependencies list, and all NuGet/MSBuild XML scanning code (-231 lines)
  • Keeps generating cgmanifest.json at build time with git submodule entries so commit hashes stay current when dependabot bumps submodules
  • Renames output to lowercase cgmanifest.json to match CG docs and other dotnet repos

The Component Governance (CG) Azure DevOps build task auto-detects NuGet
packages by scanning `.csproj` files on the build machine, making the
287-line `Step_GenerateCGManifest` in xaprepare redundant.

Only git submodules need manual registration via `CGManifest.json`, since
CG cannot auto-detect them. This commit replaces the dynamic generation
with a static `CGManifest.json` at the repo root containing only `type:
git` entries for each submodule.

Reference:
- https://docs.opensource.microsoft.com/tools/cg/component-detection/cgmanifest.md
- https://docs.opensource.microsoft.com/tools/cg/component-detection/build-task.md

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 6, 2026 16:32
Match the canonical lowercase filename used by the CG docs and other
dotnet repos (machinelearning, android-libraries, test-templates).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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

This PR is part of the incremental removal of xaprepare work by switching from a dynamically generated Component Governance manifest to a static CGManifest.json at the repo root, relying on CG’s built-in NuGet detection.

Changes:

  • Add a repo-root CGManifest.json containing type: git registrations for all submodules.
  • Remove the xaprepare Step_GenerateCGManifest implementation (which scanned project files for PackageReference).
  • Remove the Step_GenerateCGManifest step from the standard xaprepare scenario.

Reviewed changes

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

File Description
CGManifest.json Adds static CG manifest entries for git submodules.
build-tools/xaprepare/xaprepare/Steps/Step_GenerateCGManifest.cs Removes the dynamic CG manifest generator step implementation.
build-tools/xaprepare/xaprepare/Scenarios/Scenario_Standard.cs Removes the step invocation from the standard scenario.

The Component Governance (CG) Azure DevOps build task auto-detects NuGet
packages by scanning `.csproj` files on the build machine, making the
NuGet scanning in `Step_GenerateCGManifest` redundant.

Strip the step down to only generate `cgmanifest.json` entries for git
submodules, which CG cannot auto-detect. This removes the
`MSBuildPackageReferenceInfo` class, `CGManifestEntry` abstraction,
`DevelopmentDependencies` list, and all NuGet/MSBuild XML scanning code
(-231 lines).

The file continues to be generated at build time (not checked in) so
that commit hashes stay current when dependabot bumps submodules.

Reference:
- https://docs.opensource.microsoft.com/tools/cg/component-detection/cgmanifest.md
- https://docs.opensource.microsoft.com/tools/cg/component-detection/build-task.md

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jonathanpeppers jonathanpeppers changed the title Replace generated CGManifest.json with a static one Remove NuGet scanning from Step_GenerateCGManifest May 6, 2026
@jonathanpeppers jonathanpeppers changed the title Remove NuGet scanning from Step_GenerateCGManifest [xaprepare] Remove NuGet scanning from Step_GenerateCGManifest May 6, 2026
GeneratedSourceLinkJsonFile and Step_GenerateFiles use these properties.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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