Async CTP not working in VS 2010 SP1?
Asked Answered
L

3

4

I downloaded Async CTP and installed it on my development machine, which has both VS 2010 and VS 2012. The installation seemed to have completed successfully (no errors).

I created a brand new WinForms project (language: VB.NET), and decorated a Form_Load with Async.

Problem is that Async keyword is not recognized. Did anyone manage to make it work and how?

Doing the same in VS 2012, targeting .NET framework 4.5 works.

Note: I don't need any Silverlight, Windows Phone or even Web at this time.

Loveridge answered 17/4, 2013 at 14:20 Comment(4)
I tried in a C# project as well, it seems to be unrelated to the language.Loveridge
I also tried How to install the Async Targeting Pack?, which tells you can install Async Targeting Pack on VS 2010 via Nuget - Async is not recognized. I successfully installed same Targeting Pack on VS 2012.Loveridge
Since you have VS2012 which requires .NET 4.5 to be installed which is an inplace upgrade to .NET 4.0 its unlikely you will be able to install ASYNC CTP I am shocked that the installation actually allowed it.Sitdown
@Ramhound: Thanks for your feedback. It worked in my home setup - see my answer below. If you want, you can post your suggestion as an answer, I will upvote it.Loveridge
L
2

As suggested by @Ramhound, I uninstalled everything related to VS 2012 and 2010, then installed 2010 + SP1 + applied Async CTP3. Properly installed Async CTP3 shows a welcome screen and prompts to restart. After that VS 2010 starts supporting the async keyword. However, for the full support, it is required to reference a corresponding library from here (platform dependent):

c:\Users\%username%\Documents\Microsoft Visual Studio Async CTP\Samples\

In my case it was AsyncCtpLibrary.dll. Otherwise it will highlight the syntax, but won't compile.

Loveridge answered 20/4, 2013 at 19:27 Comment(1)
Probably for distributing your .NET 4.0 app using async/await, without .NET 4.5 installed, it is more useful to understand that there is no need to install Async CTP (or .NET 4.5) or reference dlls in \Samples dir but simply include AsyncCtpLibrary.dll with your project/applicationVosges
S
1

There should be no need to do this.

You already had VS2012 installed, which has full support for async/await. You can install Microsoft.Bcl.Async to get async/await support on downlevel platforms, including .NET 4.0.

Scrivner answered 26/4, 2013 at 12:40 Comment(2)
In those cases when only VS 2010 is available or it being more preferred (for example, due to stability issues of VS 2012 with WinForms), AsyncCtpLibrary is the only way. However, it's good to know there are options when you also have VS 2012 installed. I did not know Bcl.Async. Thanks and +1.Loveridge
@Stephen Cleary, Microsoft.Bcl.Async is not supported in 2010, per the documentation in the linkParatroops
R
0

I answered it in Asynchronous Programming with Async and Await and if to use more C# 5.0 features without installing .NET 4.5. /VS2012 (which is impossible in Winfows XP) than just async/await in my answer to Where can I find a TPL dataflow version for 4.0?.

Note that .NET 4.0 on machine with installed .NET 4.5 is different from .NET 4.0 with installed .NET 4.5 In other words you cannot reliably develop and test .NET 4.0 applications on machine with installed .NET 4.5. The latter is independent on wherher you installed extensions or not

Reticulate answered 26/4, 2013 at 3:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.