fsprojects / fsprojects/Paket

Error: An item with the same key has already been added

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

Nobody has claimed this yet.

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

Description

I am not sure if it's a paket bug but as it have something with the restore target and dependency management I am posting it here for now.

I have a project with this structure:

Fulma.fsproj:

  • Is a netstandard2.0 fsproj
  • TargetFramework: netstandard1.6

Fulma.Extensions.fsproj:

  • Is a netstandard2.0 fsproj
  • TargetFramework: netstandard1.6
  • It include a reference over Fulma via paket.references

Docs.fsproj:

  • Is a netstandard2.0 fsproj

  • TargetFramework: netstandard2.0

  • Include references on the twos others project via ProjectReference attributes

    <ItemGroup>
       <ProjectReference Include="../src/Fulma/Fulma.fsproj" />
       <ProjectReference Include="../src/Fulma.Extensions/Fulma.Extensions.fsproj" />
     </ItemGroup>
    

When running dotnet restore on Docs.fsproj I got this error:

docs feature/conversion *$ = $ dotnet restore
  Paket version 5.92.0-beta003
   - C:\Users\mange\Workspace\Github\MangelMaxime\Fable.Elmish.Bulma\docs\obj\docs.fsproj.netstandard2.0.paket.resolved created
   - C:\Users\mange\Workspace\Github\MangelMaxime\Fable.Elmish.Bulma\docs\obj\docs.fsproj.paket.clitools created
   - C:\Users\mange\Workspace\Github\MangelMaxime\Fable.Elmish.Bulma\docs\obj\docs.fsproj.paket.props created
   - C:\Users\mange\Workspace\Github\MangelMaxime\Fable.Elmish.Bulma\src\Fulma\obj\Fulma.fsproj.netstandard1.6.paket.resolved created
   - C:\Users\mange\Workspace\Github\MangelMaxime\Fable.Elmish.Bulma\src\Fulma.Extensions\obj\Fulma.Extensions.fsproj.netstandard1.6.paket.resolved created
  Performance:
   - Disk IO: 56 milliseconds
   - Runtime: 2 seconds
  Restoring packages for C:\Users\mange\Workspace\Github\MangelMaxime\Fable.Elmish.Bulma\src\Fulma\Fulma.fsproj...
  Restoring packages for C:\Users\mange\Workspace\Github\MangelMaxime\Fable.Elmish.Bulma\docs\docs.fsproj...
  Restoring packages for C:\Users\mange\Workspace\Github\MangelMaxime\Fable.Elmish.Bulma\docs\docs.fsproj...
  Restoring packages for C:\Users\mange\Workspace\Github\MangelMaxime\Fable.Elmish.Bulma\src\Fulma.Extensions\Fulma.Extensions.fsproj...
C:\Program Files\dotnet\sdk\2.0.0\NuGet.targets(102,5): error : An item with the same key has already been added. Key: (Fulma, 0.2.0-beta-002) [C:\Users\mange\Workspace\Github\MangelMaxime\Fable.Elmish.Bulma\docs\docs.fsproj]

I tested it with this version of paket:

  • 5.92.0
  • 5.92.0-beta003

You can reproduct this issue with this project on the branch feature/conversion

Steps:

  1. Clone the repo on branch feature/conversion
  2. Run .paket/paket.exe install
  3. cd docs
  4. dotnet restore

Also, when I was building the libs to use netstandard2.0 as fsproj format and TargetFramework it's was working as expected.

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

Reproduce the failure by running .paket/paket.exe install, then dotnet restore from docs for Docs.fsproj and inspect the generated obj files named in the report. Compare the ProjectReference entries in Docs.fsproj with the paket-generated restore outputs for Fulma.fsproj and Fulma.Extensions.fsproj. Done means the documented project structure restores without the duplicate (Fulma, 0.2.0-beta-002) key error.

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
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.