Can I use 'async' and 'await' keywords in Visual Studio 2010?

Can I use 'async' and 'await' keywords in Visual Studio 2010?

Old forum URL: forums.lhotka.net/forums/t/12154.aspx


Michael posted on Wednesday, September 18, 2013

Sorry if this seems like a silly question. Is it possible?

Thanks in advance.

—Michael

JonnyBee replied on Wednesday, September 18, 2013

No, you must use the compiler for .NET 4.5 and the .NET 4.5 SDK to get support for async/await. 

But you can use Visual Studio 2012 and async / await in applications that target .NET 4.0 (with some exceptions as no async/await in WCF or Service proxys) with the Async Targeting Pack .

"This package enables Visual Studio 2012 projects targeting .NET Framework 4 (with KB2468871), Silverlight 4 and 5, and Windows Phone 7.5 (including any portable library combinations) to use the new 'async' and 'await' keywords. This package also includes Task-based extension methods that allow using some of the existing asynchronous APIs with the new language keywords. Windows Phone 8 projects can use this package to get access to async extension methods for the networking types.

This package is not supported in Visual Studio 2010, and is only required for projects targeting .NET Framework 4.5 or .NET for Windows Store apps when consuming a library that uses this package. For known issues, please see: http://blogs.msdn.com/b/bclteam/p/asynctargetingpackkb.aspx."

Michael replied on Wednesday, September 18, 2013

Thanks, Jonny.

Copyright (c) Marimer LLC