theraot / Theraot

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

System.ValueTuple conflict #182

Open OwnageIsMagic opened 2 years ago

OwnageIsMagic commented 2 years ago

warning MSB3268: The primary reference "Quartz.dll" could not be resolved because it has an indirect dependency on the framework assembly "System.ValueTuple, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0". To resolve this problem, either remove the reference "Quartz.dll" or retarget your application to a framework version which contains "System.ValueTuple, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51". due to dependency on System.ValueTuple 4.3.0 in Theraot.Core (3.2.11) if I add System.ValueTuple 4.5.0 nuget package to the project this error goes away

NN--- commented 2 years ago

I do not see 4.0.1.0 version in NuGet

https://www.nuget.org/packages/System.ValueTuple/

Probably it is unlisted and can be used.

OwnageIsMagic commented 2 years ago

Looks like System.ValueTuple conflicts with itself if I only have Theraot.Core (which have System.ValueTuple 4.3.0) it compiles cleanly In another project where I have Vanara.Core, which have dependency on both System.ValueTuple 4.5.0 and Theraot.Core this error appears

OwnageIsMagic commented 2 years ago

Repro.zip Here is reproduction To compile remove one of dependencies in ClassLibrary1

OwnageIsMagic commented 2 years ago

even nastier it can't build anything that have transitive dependency on Vanara.Core img ClassLibrary succeeds, ConsoleApp fails.

OwnageIsMagic commented 2 years ago

Probably you just need to update System.ValueTuple 4.3.0 to 4.5.0 in Theraot.Core to resolve this

OwnageIsMagic commented 2 years ago

And if I set <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> it can't even build ClassLibrary.

NN--- commented 2 years ago

Probably you just need to update System.ValueTuple 4.3.0 to 4.5.0 in Theraot.Core to resolve this

Or downgrade to 4.0.1.0 Therapy should use the lowest versions possible in order to minimize number of such conflicts.

OwnageIsMagic commented 2 years ago

"System.ValueTuple, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" is assembly for netstandart (strange version number and it has the same PublicKeyToken) See 4.3.0 vs 4.5.0 (Framework tab) I think this is somehow related to https://github.com/dotnet/corefx/pull/42849

NN--- commented 2 years ago

It could be possible to downgrade the required package version in Vanara. However the support for .NET 4.0 has been removed. If this is important to you to have .NET 4.0 supported, please open an issue.

Removed support for .NET 2.0, 3.5, 4.0 and 4.5, .NET Core 2.0, 2.1, a… …nd 3.0 since all are or shortly will be out of support. Added support for .NET 4.6.2 and 4.8.

NN--- commented 2 years ago

@OwnageIsMagic The fix is merged into Vanara library. You just need to build a version for you with .NET 4.0 target.

OwnageIsMagic commented 2 years ago

@NN--- now I have 2 libs with ValueTuple 4.3.0 and 5 with 4.5.0 in my dependency graph nice job xD

NN--- commented 2 years ago

Seems like you have inevitable conflict. You can ask authors of other packages to lower version if this is possible at all. It can happen with any package. NuGet is not able to handle multiple versions :)

Simply add System.ValueTuple 4.5.0 package reference to your project.

OwnageIsMagic commented 2 years ago

Simply add System.ValueTuple 4.5.0 package reference to your project.

this doesn't work