AsyncCTP installation problems (and VS11)
The AsyncCTP is getting a bit long in the tooth. This post is to explain how, why, and what to do.
Common symptoms:
- AsyncCTP fails to install -- i.e. it doesn't create the "Async CTP" folder inside "My Documents", and VS doesn't recognize the async keywords.
- Installing VS11 causes AsyncCTP to stop working.
- AsyncCTP doesn't work on Windows 8.
Explanation
The AsyncCTP is an update. It updates Visual Studio 2010 with modified versions of the VS IDE compilers that colorize the new keywords. It also updates the .NET4 framework with modified versions of the command-line csc.exe and vbc.exe compilers. But the AsyncCTP was never incorporated into Microsoft's official source code for VS2010 or .NET4, and was never meant to be -- it's just an experimental CTP.
And so, when Microsoft produces official updates to either VS or .NET4, and they touch the same files, then they tend to overwrite the AsyncCTP -- or prevent it from installing in the first place.
Also .NET45, which comes with VS11 and Win8, is an in-place update on top of .NET4, and so replaces the csc.exe and vbc.exe from the AsyncCTP with updated ones. As Stephen Toub explains, the new csc.exe and vbc.exe are incompatible with AsyncCTPLibrary.dll.
What to do
- Best option is to upgrade to VS11 Beta and .NET45. It has much better async support (fewer bugs, more features, better debugging, better perf)
- Failing that, if you're stuck with VS2010 + AsyncCTP, here are ideas:
- If you already have VS2010 + AsyncCTP working, then don't install VS11.
- If you have VS2010 SP1 but the AsyncCTP installer doesn't seem to have worked, the problem might be conflicting updates such as
KB2635973, KB2615527, KB2645410
Any update after October 11 is liable to conflict, though. Go to ControlPanel > AddRemovePrograms > WindowsUpdates and uninstall them if present.
- If you already have VS2010 + AsyncCTP working, then don't install VS11.
Platforms:
- Targeting .NET45 with async:
you have to use VS11 Beta, which works fine.
- Targeting Silverlight5 or .NET4 with async:
you're currently stuck with VS2010 + AsyncCTP. We're exploring options here to let you use VS11 instead.
- Targeting Windows Phone with async:
again you're currently stuck with VS2010 + AsyncCTP.
Other ideas:
- If you can set up a VM with only VS2010 SP1 and no updates, then AsyncCTP should install fine.
Then you can copy the "Microsoft Visual Studio Async CTP" folder out of My Documents, to use on other machines.
- From the same VM, you could go C:\Windows\Microsoft.Net\Framework and copy the following files. They constitute the entirety of AsyncCTP updates to the .NET4 framework. You could copy these files to a build machine, for instance, and then msbuild would use the AsyncCTP without needing to run the installer. (Caution! This will likely break regular .NET updates!)
- csc.exe, vbc.exe, 1033\cscui.dll, 1033\vbc7ui.dll
- csc.exe, vbc.exe, 1033\cscui.dll, 1033\vbc7ui.dll
- It's theoretically possible to do the same trick for VS2010, copying just the files that were modified by the AsyncCTP installer. But this is error-prone and more likely to leave VS2010 in a broken state than not.
NB. The AsyncCTP installer has a problem with network drives: if your My Documents is mapped to a network drive, then it won't install.
Thoughts
We understand async has become indispensable for many of your projects. Ultimately, though, we can't support the AsyncCTP -- it's too fragile and has too many bugs. It took us an entire release cycle to fix it, and VS11/.NET45 is the result. The only long-term supportable strategy is for people to migrate over to VS11. As soon as we've figured out the migrate story, we'll let you know.
PS. If you notice other updates which conflict with AsyncCTP, please post in the comments here, and I'll update the instructions.
Comments
Anonymous
March 25, 2012
If you want to use async with .NET 4.0 while using the compiler from .NET 4.5 Beta, you can add this file to your project: gist.github.com/1961087 (in a separate project if you are using VB; or you could port it to VB - it's not that much code) That's a simple implementation of the classes expected by the compiler for async support. It doesn't work exactly the same as async support in .NET 4.5 (see the comment at the start of the file), but it should be good enough for most purposes.Anonymous
March 30, 2012
Daniel, that's awesome! NB. VB compiler requires the types to be in a separate DLL; they can't be source code just in the same project.Anonymous
April 03, 2012
The comment has been removedAnonymous
April 03, 2012
@Jake, I'm really sorry but we just don't have dates yet. The WP7 issue will be even harder on you, since it's not solely a matter of us producing async targeting pack for VS11+WP7, but also the phone team has to produce an entire new version of the phone SDK that works with VS11.Anonymous
April 09, 2012
AsyncBridge! Hi Lucian, Daniel, Jake, A couple of us are putting together a project called AsyncBridge (based on Daniel's gist) which lets you use async in VS 11, but target .NET 4.0. Obviously, the name is based on LINQBridge. nuget.org/.../AsyncBridge I'm planning to reimplement the same stuff that's in the AsyncCtpLibrary, like Task.Delay etc over the next few days. I think keeping the thing open source will save you guys effort while you're busy working on .NET 4.5. Let me know if you have any thoughts, AlexAnonymous
April 24, 2012
The comment has been removedAnonymous
October 07, 2012
Had to remove KB2736182 (+ others mentioned) in order to install successfully.Anonymous
April 30, 2013
The comment has been removed