System.ValueTuple is not working

I use the latest release of VS 2017 + .NET Framework 4.6.2. The compiler does not hook System.ValueTuple.dll , although it should (this is C # 7). I don’t want to install System.ValueTuple.dll with the nuget package, because the output binary does not need extra dependencies. It is remarkable that along the way

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Roslyn is System.ValueTuple.dll ,

and on the way C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2 it is not.

I tried to remove and reinstall the .NET Framework and VS 2017 did not help. Tried to shaman with the addition of System.ValueTuple.dll in \Reference Assemblies and writing in FrameworkList.xml , the same did not help. Tried to register in csc.rsp , csc.exe.config , did not help. And with all this, csi.exe works quietly with ValueTuple . How can I fix this?

  • And in the project settings there is no tick? - Grundy
  • If not in Reference Assemblies, then the class is not part of the framework, and you will have to either add a reference or install a nuget package. - PashaPash
  • This is odd, but it really is not part of the framework. Even if you put DevPack 4.6.2 - vitidev
  • not part of the framework? How? Is that part of C # 7? - Daniel Demidko
  • @ Daniel Demidko in the next versions promised to add. While System.ValueTuple is only in the form of a nuget-package. It may also be targeting pack. - Nikita

1 answer 1

You need to install the NuGet System.ValueTuple package. Open the Package Manager Console and write the command there:

Install-Package "System.ValueTuple"

After that, your code will work. Reference to the source: Predefined type 'System.ValueTuple´2´ is not defined or imported