Search code examples
c#.netasync-awaitbase-class-library

Convert projects to .Net 4.5 ( that uses TPL)


Currently own a few projects with .net 3.5 and .net 4.0.
It was decided to migrate all to .NET 4.5.

All projects are already in VS2012 (C# 5.0) and all projects using async-await keywords

On .net 4.0 projects is being used Microsoft.Bcl.Async
On .net 3.5 projects is being used AsyncBridge.Net35 and TaskParallelLibrary

The problem is:
- There is no TaskEx class and other extension methods in .net 4.5 or I do not know the existence of these

How can I make this change, without major changes in the code?


Solution

  • In .NET 4.5, the TaskEx methods have been moved into the Task class. For example, instead of await TaskEx.Run(...);, you use await Task.Run(...);. You should, assuming your naming scheme of your own classes is sane, be able to do a global search-and-replace.