External lock does not respect framework version restrictions in referencing project
Nobody has claimed this yet.
- Dominant language
- F#
- Stars
- 2.1k
- Forks
- 528
- Avg merge
- 1d 12m
- Merged PRs (30d)
- 54
Description
Description
I am having a solution with a lot of projects which share common dependencies. My projects use the new .NET SDK project style and are multi-targeting as I want to be backwards-compatible with older .NET versions (net35 being the oldest I want to support).
Some of the dependencies in my global paket.dependencies file must be used with framework version restrictions as they are suitable for the older net versions but not for netstandardXX. I absolutely do not want to repeat this dependency conditioning per-project, so I decided to rely on an external paket.lock.
Repro steps
-
Create a project which would produce the paket.lock file we need to reference in our target project. For simplicity lets call this one "Project X"
i. In Project X's paket.dependencies add a framework-restricted dependency, for example:
nuget System.Threading.Tasks.Unofficial framework: net35ii. Run
paket installfor "Project X". It'spaket.lockfile should have an entry like this:System.Threading.Tasks.Unofficial (3.1) - restriction: == net35 -
Create a project "Project Y" that would be consuming the paket.lock file created in the above step.
i. In its paket.dependencies file add:external_lock "path/to/Project X/paket.lock"ii. Run
paket installfor "Project Y". Examine the generatedpaket.lockfor that project
Expected behavior
The "Project Y"'s paket.lock should have retained the framework restriction established by "Project X":
System.Threading.Tasks.Unofficial (3.1) - restriction: == net35
Actual behavior
Instead, the "Project Y"'s paket.lock does not have the restriction in place:
System.Threading.Tasks.Unofficial (3.1)
The result of this behavior is that if "Project Y" is a multi-targeting project, and is set to build for net35 and netstandard1.3 for example, its paket restore command would fail to install:
path\to\Project.Y.csproj : error NU1202: Package System.Threading.Tasks.Unofficial 3.1.0 is not compatible with netstandard1.3 (.NETStandard,Version=v1.3). Package System.Threading.Tasks.Unofficial 3.1.0 supports:
path\to\Project.Y.csproj : error NU1202: - net35 (.NETFramework,Version=v3.5)
path\to\Project.Y.csproj : error NU1202: - sl3 (Silverlight,Version=v3.0)
path\to\Project.Y.csproj : error NU1202: - sl3-wp (Silverlight,Version=v3.0,Profile=WindowsPhone)
path\to\Project.Y.csproj : error NU1202: - sl4 (Silverlight,Version=v4.0)
path\to\Project.Y.csproj : error NU1202: - sl4-wp71 (Silverlight,Version=v4.0,Profile=WindowsPhone71)
path\to\Project.Y.csproj : error NU1202: - sl5 (Silverlight,Version=v5.0)
Known workarounds
Not really a workaround. You need to not include the external lock and manually define the dependencies you need, but this defeats the purpose of the "external-lock" directive.
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
Reproduce the behavior with the two paket.dependencies files, the external_lock directive, and the generated paket.lock files, starting with paket install and paket restore. Done means Project Y retains the == net35 restriction from Project X and restores successfully for its multi-targeting frameworks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fsharp
- Domain
- build-system, cli, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100