Skip to content

NuGet / Paket Interop on transitive dependencies #3686

Description

@matthid

Description

Consider the following scenario:

You build a class library with Paket and a direct dependency A (2.0.0)
A itself has a direct dependency on B (1.2.0), however there is also a newer version of B available (1.3.0), which is automatically referenced in the Paket lockfile.
If you package your class library (dotnet pack) the dependencies will only list A as it is the only direct dependency. This "usually works fine" (Even if it is already wrong, see below).

Now assume you work with your class library and add a feature which directly depends on B. As B is already referenced (indirectly through A) you can directly use all of Bs feature. This compiles fine without any changes. Your dependencies in the package will not change.

Now assume a regular NuGet user (or Paket user with strategy: min) uses the package:
-> The resolution will be A (2.0.0) and B (1.2.0), but as your class library is compiled against B (1.3.0) it will fail at runtime.

Repro steps

See above.

Expected behavior

Paket needs to add more direct dependencies if needed (like above) to the final package or fail with a message to add the package as direct dependency.

Actual behavior

Missing direct dependencies.

Known workarounds

Specify B as direct dependency in your class library.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions