fsprojects / fsprojects/Paket

Paket restores packages that are unrelated to project

Open
#3,455 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
F#
Stars
2.1k
Forks
528
Avg merge
1d 12m
Merged PRs (30d)
54

Description

Description

It is difficult to come up with any readable description so let's jump right into repro :)

Repro steps
  1. Using latest .NET Core SDK or MSBuild tools (version doesn't matter though) and Paker version 5.194.0.
  2. There are two projects in a solution. ProjectA targets net461 and ProjectB targets net452.
  3. Add a NuGet package to ProjectA which has a dependency that is not compatible with net452 (i.e. >= net46). This package must has no framework dependency whatsoever. I was able to find such package: ZetaLongPaths.NetStandard. It has a dependency to Microsoft.Win32.Primitives which has a framework dependency (>= net46 and others) and doesn't have a framework dependency itself.
  4. Add any other NuGet package to ProjectB (Newtonsoft.Json for example)
  5. Try to restore package for ProjectB
  6. Face an restore failure

repro.zip

Actual behavior
  1. Paket will try to install incompatible dependencies in ProjectB when there is no actual reference to them. Restore will show following errors:
Package Microsoft.Win32.Primitives 4.3.0 is not compatible with net452 (.NETFramework,Version=v4.5.2). Package Microsoft.Win32.Primitives 4.3.0 supports:
<framework versions there are supported by package>
  1. There is no restriction section in paket.lock file for Microsoft.Win32.Primitives as a root dependency:
<contents of paket.lock...>
Microsoft.Win32.Primitives (4.3)
...

paket.lock.txt

Expected behavior
  1. Paket installs only dependencies that are related to ProjectB.
  2. There are actual framework restrictions for packages that have them
Known workarounds

I was unable to find any workarounds

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 with the attached repro.zip and paket.lock example, then reproduce the restore failure for ProjectB using the two target frameworks and the listed packages. Trace how Paket resolves dependencies across projects and applies framework restrictions. Done means ProjectB restores only its related dependencies and incompatible packages retain their framework restrictions.

Written by the indexing model from the issue text.

Assessment

Tech stack
fsharp
Domain
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.