Theraot icon indicating copy to clipboard operation
Theraot copied to clipboard

System.ValueTuple conflict

Open OwnageIsMagic opened this issue 2 years ago • 13 comments

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

OwnageIsMagic avatar Feb 25 '22 20:02 OwnageIsMagic

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.

NN--- avatar Feb 25 '22 20:02 NN---

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 avatar Feb 25 '22 23:02 OwnageIsMagic

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

OwnageIsMagic avatar Feb 25 '22 23:02 OwnageIsMagic

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

OwnageIsMagic avatar Feb 25 '22 23:02 OwnageIsMagic

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

OwnageIsMagic avatar Feb 25 '22 23:02 OwnageIsMagic

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

OwnageIsMagic avatar Feb 25 '22 23:02 OwnageIsMagic

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.

NN--- avatar Feb 26 '22 07:02 NN---

"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

OwnageIsMagic avatar Feb 26 '22 10:02 OwnageIsMagic

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--- avatar Feb 27 '22 06:02 NN---

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

NN--- avatar Feb 28 '22 18:02 NN---

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

OwnageIsMagic avatar Mar 01 '22 00:03 OwnageIsMagic

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.

NN--- avatar Mar 01 '22 11:03 NN---

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

this doesn't work

OwnageIsMagic avatar Mar 02 '22 18:03 OwnageIsMagic