Skip to content

[BUG] Dependency-Review Action Does Not Resolve Versions from Directory.Packages.props in Centralized Package Management #917

Open
@dave-schmitz1

Description

@dave-schmitz1

Describe the bug
The dependency-review-action does not properly resolve package versions in C# projects that use centralized package management (Directory.Packages.props). The action inspects only .csproj files and does not account for centrally managed versions, resulting in an empty Version column in the report.

To Reproduce
Steps to reproduce the behavior:

  1. Create a C# project with the following structure:

    /src/
      MyProject/
        MyProject.csproj
    /Directory.Packages.props
    
  2. In MyProject.csproj, add a PackageReference without a version:

    <Project Sdk="Microsoft.NET.Sdk">
      <ItemGroup>
        <PackageReference Include="Newtonsoft.Json" />
      </ItemGroup>
    </Project>
  3. In Directory.Packages.props, define the package version:

    <Project>
      <ItemGroup>
        <PackageVersion Include="Newtonsoft.Json" Version="13.0.1" />
      </ItemGroup>
    </Project>
  4. Commit the change and run the dependency-review-action.

Expected behavior
The action should detect and resolve the version from Directory.Packages.props and show it in the report. In this case, it should display version 13.0.1 for Newtonsoft.Json.

Screenshots
If applicable, add screenshots to help explain your problem.

Image

Action version
What version of the action are you using in your workflow? 4.6.0

Note: if you're not running the latest release please try that first!

Additional context
This behavior reduces the usefulness of the review, as dependency versions are a critical part of understanding changes. Let me know if you'd like a minimal reproducible repository or more logs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions