RSS

Cannot find all types required by the ‘async’ modifier

19 Sep

If you use the async and await keyword in .NET 4.0 with Visual Studio 2012, you may get following error.

Cannot find all types required by the ‘async’ modifier. Are you targeting the wrong framework version, or missing a reference to an assembly?

The problem is that you have not installed the API that is necessary to use the ‘async’ and ‘await’ keyword in the 5.0 version of C#. Furthermore you get this exception only if you use those two keywords in .NET 4.0 applications. You will not see this exception neither in .NET 4.0 nor in WinRT apps.

The solution to this problem is to reference following nuGet package into all projects in which you want to use the ‘async’ and ‘await’ keyword:

Microsoft.CompilerServices.AsyncTargetingPack.

About these ads
 
Leave a comment

Posted by on September 19, 2012 in C-Sharp

 

Tags: ,

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

%d bloggers like this: