Home >Backend Development >C++ >Why am I getting the 'Predefined type 'System.ValueTuple' is not defined or imported' error in .NET?
When attempting to use the new tuple feature in .NET Core, developers may encounter the error "Predefined type 'System.ValueTuple' is not defined or imported." This error indicates that the necessary tuple type has not been defined or imported into the project.
Despite the blog post suggesting that the feature should be enabled by default, it may not be in all cases. To resolve this issue, developers need to install the System.ValueTuple NuGet package.
For .NET 4.6.2 or lower, .NET Core 1.x, and .NET Standard 1.x, use the following PowerShell command:
Install-Package "System.ValueTuple"
In Visual Studio 2017, use a package reference:
<PackageReference Include="System.ValueTuple" Version="4.4.0" />
Note that .NET Framework 4.7, .NET Core 2.0, and .NET Standard 2.0 already include these types.
The above is the detailed content of Why am I getting the 'Predefined type 'System.ValueTuple' is not defined or imported' error in .NET?. For more information, please follow other related articles on the PHP Chinese website!