Search code examples
f#dependency-managementpaket

Is it possible to remove irrelevant restrictions from paket.lock?


I have discovered that my paket.lock file contains a lot of things I don't care about, e.g.:

System.Memory (>= 4.5.3) - restriction: || 
(&& (< monoandroid) (< monotouch) (< net45) (>= netstandard1.3) (< netstandard2.0) (< win8) (< wpa81) (< xamarintvos) (< xamarinwatchos)) 
(&& (< net45) (< netcoreapp2.1) (>= netstandard2.0) (< xamarinios) (< xamarinmac)) 
(>= net46) 
(>= uap10.1)

I don't want to think about monoandroid or wpa81 or uap10.1 and so on and it is hard to understand what is really going on there after I have recently got some dependency conflict. I want something neat e.g. like this.

I read some docs and tried the framework restriction thing in paket.dependencies: framework: netstandard20, netcoreapp30. But it did not really change much after paket install. I have tried adding this to every group - to no avail as well. I tried running paket update and paket simplify, I tried to remove the lock file and to paket install everything again.

Am I doing something wrong, like not adding directions to paket.dependencies or running wrong paket command?

Or is it just the way things are?


Solution

  • These declarations in the paket.lock file aren't irrelevant. You're seeing this because the System.Memory package you're depending on, either directly or implicitly, has a lot of targets it can run on. Paket is resolving the package and correctly serializing the resolution rules. Should you do something like multi-target in the future, and one of those targets isn't supported for the package, you'll correctly get a package resolution failure. However, if you delete these, you'll likely end up with a runtime failure.