"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"
Alternatively, you can add the following package reference in Visual Studio 2017:
<PackageReference Include="System.ValueTuple" Version="4.4.0" />
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!