March 22, 2020

Tuple Compile Error - TupleElementNamesAttribute cannot be found

Problem:

The first time you use tuples in C# Projects, you may encountered this error:

Cannot define a class or member that utilizes tuples because the compiler required type 'System.Runtime.CompilerServices.TupleElementNamesAttribute' cannot be found.

Solution:

All you have to do is install System.ValueTuple nuget package.

From Package Manager Console, run this command:

Install-Package System.ValueTuple -Version 4.5.0

You may want to change the version if required.

Or from Manage NuGet Packages... tab, search for System.ValueTuple and Install.

No comments:

Post a Comment