fsprojects / fsprojects/Paket

Transitive dependencies have wrong restriction

Open
#3,232 6 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

This seems to be similar to #1213.

I have a web app that I've split into two projects so the EF stuff can be in C# and the rest in F#.

Project Target Package Ref
Web App netcoreapp2.1 Microsoft.AspNetCore.App
EF Lib netstandard2.0 Microsoft.EntityFrameworkCore.SqlServer

So the initial paket.dependencies looks like this:

source https://api.nuget.org/v3/index.json

nuget Microsoft.AspNetCore.App
nuget Microsoft.EntityFrameworkCore.SqlServer

The paket.lock file ends up with this for the EF package:

Microsoft.EntityFrameworkCore.SqlServer (2.1)
  Microsoft.EntityFrameworkCore.Relational (>= 2.1) - restriction: >= netstandard2.0
  System.Data.SqlClient (>= 4.5) - restriction: >= netstandard2.0

As the EF bits are also pulled in by the meta-package, I would have thought (and paket simplify agrees) that Microsoft.EntityFrameworkCore.SqlServer can be removed from paket.dependencies. If I do this, remove paket.lock and run paket install again, then a bunch of restrictions change. The previous excerpt becomes this:

Microsoft.EntityFrameworkCore.SqlServer (2.1) - restriction: >= netcoreapp2.1
  Microsoft.EntityFrameworkCore.Relational (>= 2.1) - restriction: >= netstandard2.0
  System.Data.SqlClient (>= 4.5) - restriction: >= netstandard2.0

And now the EF project won't build because there's no package available for netstandard2.0.

I've created a minimal repro solution where you can see the diff between the paket.lock files.

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 minimal repro solution and compare the linked paket.lock diff. Read the paket.dependencies entries, then run paket simplify and paket install with and without the direct EF package. Done means the generated restrictions preserve the netstandard2.0 dependency and both projects build.

Written by the indexing model from the issue text.

Assessment

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