Essay record
DotNet Core: Tuple could not be found
- Record
- Essay / / 1 min read / 149 words
On this page2 sections / +
DISCLOSURE: Some links may be affiliate links. Details
Problem
I'm trying to use a Tuple in my dotnet core project but it keeps giving me the error The type of namespace name 'Tuple<,>' could not be found (are you missing a using directive or an assembly reference?).
Solution
In DotNet core, particularly if you're not using enterprise-grade tools like Visual Studio, using some of the core libraries takes extra steps.
First off, you need to install the System.ValueTuple package in your project so that you can actually use Tuple. You can do this via commandline with:
dotnet add package System.ValueTuple
Now that it's added in your project, you can use it in your C# file by adding to the top of your file:
using System;
...
namespace MyNamespace {
...
}
Note that we don't pull in System.ValueTuple cause that's a type, not the namespace that contains the type we want.