theraot / Theraot

Backporting .NET and more: LINQ expressions in .net 2.0 - nuget Theraot.Core available.
MIT License
162 stars 30 forks source link

Lower PackageReference required version #79

Closed NN--- closed 5 years ago

NN--- commented 5 years ago

Theraot.Core could require lower version. E.g. System.ComponentModel.Annotations now is set to 4.5.0 while it could be set to 4.3.0

dahall commented 5 years ago

Reverting back has caused build problems with .NetStandard2.0, .NetCore2.0 and .NetCore2.1 which are not supported by System.ComponentModel.Annotations v4.1.0.

theraot commented 5 years ago

@dahall on it

theraot commented 5 years ago

@dahall just uploaded new nuget.

I made all the dependencies the lastest version. I suppose that is better than trying to track minimun versions.

Also last nuget did not target .NET Standard 2.0 explicitly, so when you added it to a .NET Standard 2.0 it was using a version that was not configured for it. The new nuget has an assembly for .NET Standard 2.0.

NN--- commented 5 years ago

Latest version is a problem. If you have a dependency on Theraot then you require from all your consumers to use the latest version which can be impossible.

theraot commented 5 years ago

@NN---

I intend to reference the last version that works for each target. Why would you not be able to use if you are on that target? It turns out that for every library I am referecing that is latest version.

Besides, am I requiring them? or Nuget just pulls the libraries automatically?


Ok, let us take an step back. The problem was that on a newer target, were they were able to link a library for an older target, they were using a library that dropped support for the old target.

In particular, the project is on .NET Standard 2.0, has a reference on System.ComponentModel.Annotations 4.5.0 and they want to reference Theraot.Core 3.0.3. However, Theraot.Core 3.0.3 references System.ComponentModel.Annotations 4.1.0. Here is the kicker: They cannot use System.ComponentModel.Annotations 4.1.0 in .NET Standard 2.0, it is not supported.


Alright, solutions. I can tell Nuget to update everything, which takes me a while because I need to check every target. Or I could search the minimun working version for each target. Which will take me longer, because I need to search the minimun working version for each target.

Plus, if I reference an older version that can cause problem when new targets appears. Thus, referecing the minimun working version is not buying me anything.


You know what, thinking about it, Nuget should have taken a newer version of System.ComponentModel.Annotations that was supported on the target and use that one instead. The version is understood as asking for greater or equal, after all. I think Nuget believed System.ComponentModel.Annotations 4.1.0 should work on .NET Standard 2.0 just like Theraot.Core 3.0.3 should work on .NET Standard 2.0. After all, there is no way to tell Nuget that the library does not support a target that is yet to be released, and Nuget tries to load a compatible inferior target when the specific one is not included.

How do we solve that?

NN--- commented 5 years ago

If .NET Standard 2.0 has minimum requirement of 4.5.0 then Theraot should obey that. But what if .NET Standard 1.3 is good with lower version such as 4.0.1. Is there a reason for Theraot to require higher version than needed ?

theraot commented 5 years ago

@NN--- because it is easy.

Alright, I will find out the minimun version of each dependency that builds and passes all tests for every platform, someday.

theraot commented 5 years ago

Nuget version 3.1.0