Home >Backend Development >C++ >Why is 'Predefined type 'System.ValueTuple' Unavailable' in Visual Studio 15 and how can I fix it?

Why is 'Predefined type 'System.ValueTuple' Unavailable' in Visual Studio 15 and how can I fix it?

Barbara Streisand
Barbara StreisandOriginal
2024-12-28 18:13:16316browse

Why is

Predefined Type 'System.ValueTuple' Unavailable

In Visual Studio 15 Preview 3, users face a compilation error when utilizing the new tuple feature. The error message reads, "Predefined type 'System.ValueTuple´2´ is not defined or imported."

Cause and Solution:

This issue arises when using .NET 4.6.2 or lower, .NET Core 1.x, or .NET Standard 1.x. To resolve this, install the NuGet package System.ValueTuple using the following command in PowerShell:

Install-Package "System.ValueTuple"

For Visual Studio 2017, use a package reference:

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

For .NET Framework 4.7, .NET Core 2.0, and .NET Standard 2.0, these types are included by default.

The above is the detailed content of Why is 'Predefined type 'System.ValueTuple' Unavailable' in Visual Studio 15 and how can I fix it?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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