Skip to content

fix: add support for Project and CentralTransitive in NuGet parser#5232

Open
mmustafasenoglu wants to merge 1 commit into
aboutcode-org:developfrom
mmustafasenoglu:fix/nuget-project-central-transitive
Open

fix: add support for Project and CentralTransitive in NuGet parser#5232
mmustafasenoglu wants to merge 1 commit into
aboutcode-org:developfrom
mmustafasenoglu:fix/nuget-project-central-transitive

Conversation

@mmustafasenoglu

Copy link
Copy Markdown

Summary

Adds support for Project and CentralTransitive dependency types in the NuGet packages.lock.json parser.

Problem

NuGet lockfiles can contain dependency types beyond Direct and Transitive:

  • Project: Local project references (e.g., <ProjectReference>)
  • CentralTransitive: Transitive dependencies managed via Central Package Management

The parser raised an exception for these unknown types:

Unknown package type: Project
Unknown package type: CentralTransitive

This caused parsing to abort for valid NuGet lockfiles generated by projects using project references or Central Package Management.

Changes

  • src/packagedcode/nuget.py: Added handling for Project (is_direct=True) and CentralTransitive (is_direct=False) types
  • Added test fixture with these dependency types

Testing

Added packages.lock.with_project_and_central_transitive.json test fixture containing all four dependency types.

Fixes #5106

…n NuGet parser

NuGet lockfiles can contain dependency types 'Project' and
'CentralTransitive' in addition to 'Direct' and 'Transitive'.
The parser raised an exception for these unknown types, causing
parsing to abort for valid NuGet lockfiles.

This fix adds handling for:
- Project: treated as direct dependency (is_direct=True)
- CentralTransitive: treated as transitive dependency (is_direct=False)

Also adds a test fixture with these dependency types.

Fixes aboutcode-org#5106
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.

NuGet packages.lock.json parser fails on Project and CentralTransitive dependency types

1 participant