fsprojects / fsprojects/Paket

Wrong resolution when different targets depend on conflicting versions

Open
#3,220 0 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

I'm trying to install dotNetRDF in a project which targets .NET Standard 1.5 and 2.0. That package depends on another which has mutually exclusive restrictions for those two targets. Here's a excerpt from the lock file

NUGET
  remote: https://www.nuget.org/api/v2
    dotNetRDF (2.0.1)
      Microsoft.Extensions.Configuration (>= 1.1.2) - restriction: && (< net40) (>= netstandard1.4) (< netstandard2.0)
      Microsoft.Extensions.Configuration (>= 2.0) - restriction: && (< net40) (>= netstandard2.0)

Using Paket version 5.167.1

Repro steps

Here's an example repository:

ClassLibrary1.zip

Unzip and run dotnet restore

Expected behavior

Version 1.1.2 should be used by netstandard1.5 target
Version 2.0 should be used by netstandard2.0 target

Actual behavior

dotnet restore fails because Paket tries to apply version >= 2.0 to both targets

error NU1202: Package Microsoft.Extensions.Configuration 2.0.2 is not compatible with netstandard1.5 (.NETStandard,Version=v1.5). Package Microsoft.Extensions.Configuration 2.0.2 supports: netstandard2.0 (.NETStandard,Version=v2.0) [C:\Projects\temp\ClassLibrary1.sln]
  Restore failed in 843,19 ms for C:\Projects\temp\ClassLibrary1\ClassLibrary1.csproj.

netstandard

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

Unzip the provided ClassLibrary1.zip reproduction and run dotnet restore with Paket 5.167.1, then inspect the lock file entries for Microsoft.Extensions.Configuration across the netstandard1.5 and netstandard2.0 targets. Done means the restore selects version 1.1.2 for netstandard1.5 and version 2.0 for netstandard2.0 without the NU1202 compatibility error.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.