Skip to content

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

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

Open
dave-schmitz1 opened this issue Apr 10, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@dave-schmitz1
Copy link

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.

@dave-schmitz1 dave-schmitz1 added the bug Something isn't working label Apr 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant