question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remove dependency on System.ValueTuple NuGet package when targeting .Net 4.7

See original GitHub issue

After switching project from .NET 4.6.1 to .NET 4.7.2 the following errors appear:

Severity	Code	Description	Project	File	Line	Suppression State
Error	CS8356	Predefined type 'System.ValueTuple`2' is declared in multiple referenced assemblies: 'System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' and 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ...

The possible reason is that System.ValueTuple is incompatible with .Net Framework 4.7 (because it’s already built in to 4.7).

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

19reactions
vlardncommented, Sep 15, 2018

Actually there is a workaround for now: use a .NET 4.7 build of System.ValueTuple that seems just contains references to value tuple types from mscorlib. There are 2 ways how to do it:

  1. . Change to “net47” in HintPath like this:
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
  <HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
</Reference>
  1. Or use “Update-Package -Reinstall” to update all such packages. I think this is preferable method after switching to another .NET framework version but it usually produces much more changes.
2reactions
yodasadcommented, Feb 7, 2020

I’m going to remove it completely 👍

Anyway that’s the best solution, there is no need in the library “System.ValueTuple” at all if one is targeting .NET47 or higher.

Read more comments on GitHub >

github_iconTop Results From Across the Web

System.Text.Json packages adds System.ValueTuple ...
Text. Json nuget package (v 5.0. 2), see that it says it's going to add dependent packages including System. ValueTuple.
Read more >
System.ValueTuple and .NetFramework 4.7.2
This is happening in CI/CD server with MSBuild but not with Visual Studio build in local system. Indirect dependency on the framework assembly( ......
Read more >
Could not locate the assembly "System.ValueTuple"
My project has a dependency on System.ValueTuple that is downloaded with NuGet. Everything builds fine in Visual Studio and our build server ...
Read more >
Troubleshoot .NET Framework targeting errors
This article provides resolutions for MSBuild errors that might occur because of reference issues.
Read more >
What's new in .NET Framework
See what's new in various versions of .NET Framework. Read a summary of key new features and improvements in each version.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found