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

2020.12.13 | 70 words |

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;

 

About the Ham

Hi I'm Hamilton - I built this! If you want more content like this subscribe to my email list, connect with me around the web, or take a look at some of my other projects.

More Projects

comments powered by Disqus