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

Skip to content

Remove cgmanifest.json and save packages dynamically #49538

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 24, 2025

Conversation

mariam-abdulla
Copy link
Member

@mariam-abdulla mariam-abdulla commented Jun 24, 2025

This pull request introduces changes to streamline component governance tracking and enhance integration tests for dotnet-new. The most significant updates include removing the cgmanifest.json file, adding a mechanism to record package references during tests, and implementing a new helper method for extracting package information from project files.

Component Governance Updates:

  • Removed the cgmanifest.json file, which previously tracked component registrations for NuGet packages. This change simplifies the repository by eliminating manual component governance tracking.

Integration Test Enhancements:

  • Added a new helper method, RecordPackages, to extract and save package references from .csproj, .fsproj, and .vbproj files into a packages.json file during test execution. This ensures that package usage is automatically recorded for component governance.
  • Updated multiple test methods (ItemTemplate_CanBeInstalledAndTestArePassing, ProjectTemplate_CanBeInstalledAndTestsArePassing, and MSTestAndPlaywrightProjectTemplate_WithCoverageToolAndTestRunner_Can) to call RecordPackages after executing dotnet new. This integrates package recording into the test workflow. [1] [2] [3]

Codebase Improvements:

  • Added CgPackagesJsonPath as a static readonly field to define the path for the new packages.json file, centralizing its location for easier management.
  • Included new using directives for System.Text.Json and System.Text.RegularExpressions to support JSON serialization and regex operations in the DotnetNewTestTemplatesTests file.

The tests I added generate test projects using dotnet new, but these are eventually deleted and placed in the artifacts folder. By the time the CG step in the pipeline runs, those projects are already gone—and the artifacts folder is excluded from processing anyway.

So I had two options:

  • Keep the test projects and move them to a different folder.
  • Dynamically extract the reported packages and write them to a file that CG can consume.

I went with option 2 to keep things clean and avoid polluting the repo with temporary test projects.

@Copilot Copilot AI review requested due to automatic review settings June 24, 2025 08:21
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 pull request removes the obsolete component detection metadata file used for NuGet dependencies.

  • Removed the entire content of eng/cgmanifest.json which previously provided dependency metadata.
  • Simplified the project configuration by eliminating unused dependency metadata.

@mariam-abdulla mariam-abdulla requested a review from a team as a code owner June 24, 2025 09:46
@mariam-abdulla mariam-abdulla changed the title Remove cgmanifest.json Remove cgmanifest.json and save packages dynamically Jun 24, 2025
@mariam-abdulla mariam-abdulla enabled auto-merge (squash) June 24, 2025 12:38
@mariam-abdulla mariam-abdulla merged commit 3c21adb into main Jun 24, 2025
30 checks passed
@mariam-abdulla mariam-abdulla deleted the dev/mabdullah/remove-cgmanifest-json branch June 24, 2025 13:50
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.

3 participants