Paket restores packages that are unrelated to project
Open
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
- Using latest .NET Core SDK or MSBuild tools (version doesn't matter though) and Paker version 5.194.0.
- There are two projects in a solution. ProjectA targets
net461and ProjectB targetsnet452. - 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 toMicrosoft.Win32.Primitiveswhich has a framework dependency (>= net46and others) and doesn't have a framework dependency itself. - Add any other NuGet package to ProjectB (
Newtonsoft.Jsonfor example) - Try to restore package for ProjectB
- Face an restore failure
Actual behavior
- 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>
- There is no restriction section in
paket.lockfile forMicrosoft.Win32.Primitivesas a root dependency:
<contents of paket.lock...>
Microsoft.Win32.Primitives (4.3)
...
Expected behavior
- Paket installs only dependencies that are related to ProjectB.
- 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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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