Installation Instructions & Release Notes

The "Async Targeting Pack for Visual Studio 2012" enables projects targeting .NET Framework 4.0 or Silverlight 5 to use the Async language feature in C# 5 and Visual Basic 11. This pack requires Visual Studio 2012 and will not work with Visual Studio 2010.

The pack contains the API support necessary to use the 'async' and 'await' keywords in C# 5.0 and Visual Basic 11, as well as a set of Task-based adapter APIs that allow using some of the existing asynchronous APIs with the new language keywords.

This targeting pack is not required for projects targeting .NET Framework 4.5 or .NET for Metro style apps. It is only required for projects targeting Silverlight 5 and .NET Framework 4.0. Earlier platform releases are not supported.


More info on Task-based asynchronous programming in .NET:

In this document:


The Async Targeting Pack for Visual Studio 2012 consists of a set of managed code assemblies that contain support types required by the C# and Visual Basic compilers integrated into Visual Studio 2012 and .NET 4.5 in order to support the 'async' and 'await' keywords, as well as some Task-based adapters for existing APIs. The pack is distributed via the NuGet package management system. One single NuGet package contains assemblies for all of the platforms supported by the Async Targeting Pack and the NuGet package manager will automatically ensure that your project references the correct assemblies.

If you are already familiar with NuGet:

The package ID of the Async Targeting Pack that you can use when searching for it is:

You can also visit the NuGet package information page for management console instructions.

If you are not yet very familiar with NuGet:

In order to familiarize yourself with the NuGet system, to learn how to enable it in your Visual Studio 2012 and how to install the Async Targeting Pack into your project, please read the following pages:

Release Notes

For each supported platform, two related, but distinct groups of functionality are included:

  1. Support types required by the Visual Studio 2012 C# and Visual Basic compilers to use the 'async' and 'await' keywords.
  2. Task-based adapter APIs that allow using some of the asynchronous APIs that exist in the targeted platform version with the new language keywords.

Both groups of functionality have some differences to the equivalent features in .NET 4.5, and .NET for Metro Style Apps. A non-exhaustive list of these differences includes:

.NET 4.5 / .NET for Metro Style Apps behavior Async Targeting Pack behavior
There are some new static convenience APIs on the Task class (e.g. Task.Run(..)). The new static convenience APIs are located on the TaskEx class (e.g. TaskEx.Run(..)).
.NET 4.5 has new, customized, more performant implementations for many Task-based asynchronous APIs. Many Task-based Async methods included in this Async Targeting Pack have the same signatures as new Task-based Async methods added in .NET 4.5. The functionality of these methods is generally intended to be equivalent, but it is not always identical. This is because the APIs in this Targeting Pack are usually thin Task-based adapters for functionality already available on the respective platform.
Changes made to the current ExecutionContext inside of an async method are undone prior to returning to the synchronous caller in an efficient manner. Changes made to the current ExecutionContext inside of an async method are not undone prior to returning to the synchronous caller and are thus visible to the caller.
When awaiting a cancelled Task returned from an async method, the same OperationCanceledException object that caused the Task to be cancelled is propagated out of awaiting on that Task. A new / different OperationCanceledException is thrown from the await.
When directly using TaskAwaiter*.UnsafeOnCompleted in .NET 4.5, the ExecutionContext is not flowed. The ExecutionContext is still flowed when using any of the UnsafeOnCompleted methods.
If an awaited Task completes on the "right" SynchronizationContext, its Continuation does not need to be posted back to the SynchronizationContext captured when the Task was started. Continuations are always posted to the captured SynchronizationContext.
Visual Studio 2012 Debugger supports step-out for async methods (via special methods on the Task class). Visual Studio 2012 Debugger does not support step-out for async methods.
A number of pre-completed Task objects are cached for use by async methods of different return types. Fewer pre-completed Task objects are cached for use by async methods.
When awaiting Task.Delay(.., CancellationToken) and if the returned Task completes as Canceled because the CancellationToken was canceled, the OperationCanceledException that gets thrown will have the CancellationToken stored in it. The CancellationToken is not stored in the OperationCanceledException.
Task.Run(..) uses the new TaskCreationsOptions.DenyChildAttach option. TaskEx.Run(..) does not use the TaskCreationsOptions.DenyChildAttach option, because it is not available.
If the Func<Task> delegate passed to the unwrapping overloads of Task.Run synchronously throws an OperationCanceledException, the returned Task gets cancelled. The returned Task gets faulted.