Duplicate references after install (paket reference and project reference of a same dependency)
Nobody has claimed this yet.
- Dominant language
- F#
- Stars
- 2.1k
- Forks
- 528
- Avg merge
- 1d 12m
- Merged PRs (30d)
- 54
Description
Description
While using paket as primary package and dependency manager we experiencing an issue of duplicate references while running paket install. The root cause of duplication is: project reference within solution of a dependency and nuget binary reference to the same dependency.
Similar to #878 (closed on no repro).
Repro steps
- Create a paket enabled solution
- Create a project AAA.Interface with single interface class
- Create a nuget package from AAA.Interface
- Create a project AAA
- Add project reference from AAA to AAA.Interface
- Add paket reference AAA.Interface in AAA's paket.references
Such way the same dependency AAA.Interface is referenced both as a project and as a nuget dependency.
Pay attention
I prepared the repro when direct dependency is referenced and also a separate repro for transient dependency reference.
Two separate solutions in zip attached along with screenshots of compiler error and duplicate project references.
Expected behavior
I would expect the install command won't add both paket reference and project reference for the same dependency AAA.Interface.
Including the case of transient dependency that also could be project referenced.
The assumption that equality resolved by project name and nuget package id (case sensitive).
I think the install should be preferring project reference and not the paket reference.
Visual studio actively prevents adding reference to a project if already has same reference by name.
Actual behavior
Both paket and project reference added into .csproj file, causing compilation error CS1704.
The compiler raising error when version of the paket dependency assembly is different to version of project reference assembly (that is the most of the cases). If version is the same, compiler selecting arbitrarily and no error raised.
Known workarounds
We desided to avoid project references, while relying on paket references.
It creates significant overhead in debugging, as we have to compile, pack, push and restore such dependency to actually be able to see updated code.
Related information
- Operating system: Any
- Branch: Any
- .NET Runtime Version: 4.5.1
- Paket version 5.195.7
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 by opening duplicate.references.zip and reproducing the issue with paket install using the direct and transient dependency cases. Inspect the generated .csproj references; done means the install keeps the project reference and does not add a duplicate Paket/NuGet reference for the same dependency.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fsharp
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100