Home > Backend Development > C++ > Why Am I Getting the 'Predefined Type 'System.ValueTuple`2' Not Found' Error in Visual Studio?

Why Am I Getting the 'Predefined Type 'System.ValueTuple`2' Not Found' Error in Visual Studio?

Susan Sarandon
Release: 2024-12-30 13:03:10
Original
752 people have browsed it

Why Am I Getting the

"Predefined Type 'System.ValueTuple`2' Not Found: Unveiling the Solution"

Visual Studio 15 Preview 3 introduces the innovative tuple feature, allowing you to easily work with immutable collections of data. However, some users encounter the perplexing error message "Predefined type 'System.ValueTuple`2' is not defined or imported." This question and answer exploration unravels the source of this issue and provides a simple solution.

The error arises when referencing tuple data structures, which require a certain component depending on the version of .NET being utilized. For .NET 4.6.2 and below, as well as .NET Core 1.x and .NET Standard 1.x, the resolution involves installing the NuGet package "System.ValueTuple." This is easily accomplished using the following command:

Install-Package "System.ValueTuple"
Copy after login

Alternatively, you can add the following package reference in Visual Studio 2017:

<PackageReference Include="System.ValueTuple" Version="4.4.0" />
Copy after login

For those using .NET Framework 4.7, .NET Core 2.0, and .NET Standard 2.0, these types are included by default, eliminating the need for external installations.

The above is the detailed content of Why Am I Getting the 'Predefined Type 'System.ValueTuple`2' Not Found' Error in Visual Studio?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template