C#: The type or namespace name 'Task<>' could not be found

Essay - Published: 2020.12.13 | 1 min read (72 words)
csharp | dotnet-core | task

DISCLOSURE: If you buy through affiliate links, I may earn a small commission. (disclosures)

Overview

I'm building an app with .NET Core and using async Tasks in it. When I go to build it I'm faced with this error:

error CS0246: The type or namespace name 'Task<>' could not be found

How do I fix this?

Solution

Usually this just means you're missing an import statement. For Tasks, you'll need to import by adding this line to the top of your file:

using System.Threading.Tasks;

Want more like this?

The best way to support my work is to like / comment / share this post on your favorite socials.