fsprojects / fsprojects/Paket

Losing version-range when 'dotnet pack'

Open
#2,883 16 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement up-for-grabs
Dominant language
F#
Stars
2.1k
Forks
528
Avg merge
1d 12m
Merged PRs (30d)
54

Description

Description

Yet again, it might not be paket's problem, but maybe there is something you can do about it.

Guys from 'NLog' team made a mess and rolled back version making making 4.5 newer than 5.0.

My library, let's call it libA requires version 4.5 so paket.dependencies contains:

nuget NLog ~> 4 beta

and it is getting 4.5. So far, so good.

Now, my other project, let's call it appB, which uses libA does not know or care about NLog. The only dependency it has is libA:

nuget libA

But... when I do paket install it resolves NLog version 5.0.

Apparently, dotnet pack for libA puts the restriction >= 4.5 instead of >= 4.5 && < 5.

Long story short, my very precise restrictions about versions are lost when crossing dotnet pack boundary.

Repro steps

nlfu.zip

Run setup.cmd. Notice NLog 4 is referenced in libA (correctly) but appB references NLog 5 (wrongly).

Expected behavior

Both libA and appB reference version 4 of NLog.

Actual behavior

Restrictions are "forgotten", and appB references "newest" version of "NLog"

Known workarounds

Explicitly put restrictions in appB again (even if assembly is not used directly).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by extracting nlfu.zip and running setup.cmd, then compare the NLog versions and dependency restrictions resolved for libA and appB. Trace how dotnet pack records libA's dependency and how paket install consumes it; done means appB preserves the NLog 4 restriction instead of resolving NLog 5.

Written by the indexing model from the issue text.

Assessment

Tech stack
fsharp
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.