The type or namespace name 'async' could not be found [duplicate] The type or namespace name 'async' could not be found [duplicate] wpf wpf

The type or namespace name 'async' could not be found [duplicate]


Well, there are two things:

  • You need to be using a C# 5 compiler, e.g. VS2012. If you're using VS2010, you can't use async. Given the error message, I suspect that you're using the wrong compiler version.
  • You need to use the Microsoft.Bcl.Async NuGet package to bring in the appropriate library support for .NET 4.


In my case the return type was missing, message was cause by code:

private async button1_Click(object sender, EventArgs e)

and should be

private async void button1_Click(object sender, EventArgs e)


If you are using Visual Studio 2012+ and you stop typing the moment you get a red squiggley line, you may see this error message on the async keyword until you finish writing the method signature.

Finish writing the method signature, make sure there aren't any other compiler issues, and wait a second or so for Visual Studio to catch up.