Async Targeting Pack for Visual Studio 11 now available for .NET 4 and Silverlight 5

Async Targeting Pack for Visual Studio 11 now available for .NET 4 and Silverlight 5

Rate This
  • Comments 4

If you’ve held off on trying Visual Studio 11 Beta because your .NET 4 or Silverlight 5 app uses the Async CTP, your wait is over!  Today we’ve published the Async Targeting Pack for Visual Studio 11, a NuGet package that lets your Visual Studio 11 projects target .NET 4 and Silverlight 5 while taking advantage of C#’s new await keyword.  While Visual Studio 11 provides built-in support for await in projects that target .NET 4.5 or .NET for Metro style apps, this targeting pack provides the API support to expand the set of target platforms to include .NET 4 and Silverlight 5 as well.

Check out our release notes for more details on how to install NuGet and add the package reference in Visual Studio 11 Beta.

Happy testing!

Alex Turner
Program Manager, VB/C# Compilers

Leave a Comment
  • Please add 2 and 2 and type the answer here:
  • Post
  • Hi Alex

    I have one concern with the new targeting pack and developing in VS 11 while targeting .NET 4.

    In our office we created an small spike WCF solution (Server/Client) that uses a ServiceContract let's say ISomeService that has one operation contract that returns a Task<T>. For creating this we used VS 11 with the new targeting pack and of course we were targeting .NET 4 for both projects Server and Client.

    Now the problem is that even though we know WCF 4 cannot serialize Tasks our solution compiled and ran perfectly in our development PC but when testing it in an XP PC with just .NET 4 installed for obvious reasons (.NET 4.5 doesn't support XP) our bits failed with the exception that Tasks cannot be serialized etc etc. perfectly understandable since .NET 4 cannot serialize Tasks.

    Now we can avoid this and not use Task<T> returning services in WCF since we are targeting .NET 4 because we now about this problem and NOT because when we were developing and testing VS 11 even targeting .NET 4 failed, which is the behavior I will expect from VS 11 to fail when I try to run a project that targets .NET 4 the way is not supposed to be used.

    So my real concern is what kind of other problems we can be incurring in using async/await features while developing in VS 11 + Async Targeting pack even though you target .NET 4 rather than using VS 2010 + Async CTP. I mean we will be incurring into those problems since we will be developing in VS 11 thinking that we are safe because we targeted .NET 4 framework when in reality when we test our apps in an environment with just .NET 4 they can fail.

    Even worse my wild guess is that all these problems are related to the fact that .NET 4.5 is an in-place update to .NET 4 so what ever .NET 4.5 fixed, improved, added or replaced from .NET 4 will be the real stuff we will be using in our development environments with VS 11 and .NET 4.5 no matters we explicitly target .NET 4 leading to a possible failure when our apps run in a just .NET 4 environment.

    So my point here is what is the advantage to use VS 11 + Async targeting pack for targeting .NET 4 over VS 2010 + Async CTP if at the end chosing the first can shoot ourselves in the foot.

    I would really appreciate if someone knows a way to overcome this problem (I mean being able to properly use VS 11 + Async targeting pack while targeting .NET 4 knowing that our apps will safely run in for example XP), probably we did something wrong with our spike WCF solution. Any feedback will be greatly appreciated.

    by the way does anyone know if at the end .NET 4.5 will support XP this will make our lives easier ;-) or if at least the final .NET 4.5 will be a side by side installation rather than in-place update (I guess this could solve my problem as well eventhough I much prefer .NET 4.5 supporting XP so we can all make use of the new features at full capacity)

    Regards,

    Ariel

  • It's a nice idea, but I still get the "TaskAwaiter does not implement INotifyCompletion" errors  after installing the targeting pack.

    It looks like our shop will be skipping .NET 4.5 and VS11, unless there are major changes before release. It's a shame the days of backward compatibility seem to be gone. As somebody who has always jumped to the latest development tools as soon as possible, this makes me sad.

  • I'm also a little confused (after reading the previous comment) about how to use the targeting pack. I have installed it but am not using it yet.

    I would hope that to target .Net 4, I don't have to change my code back to the way it was for the Async CTP. (i.e. change Task back to TaskEx and remove INotifyCompletion references.)  Anyway, implementing INotifyCompletion took about as long as it took to type " : INotifyCompletion" after awaiter's class names, since it defines a single method that we already had to implement anyway.

    I wouldn't want backwards compatibility with a CTP; that would be silly in my view... I'd rather write code for VS 11 and have it *work* on .Net4.

  • Hi,

    It would be excellent to see a broader support for async in SL5 as described in: visualstudio.uservoice.com/.../2939486-enable-add-reference-with-option-generate-asynchr

Page 1 of 1 (4 items)