简体   繁体   English

将项目转换为.Net 4.5(使用TPL)

[英]Convert projects to .Net 4.5 ( that uses TPL)

Currently own a few projects with .net 3.5 and .net 4.0. 目前拥有.net 3.5和.net 4.0的一些项目。
It was decided to migrate all to .NET 4.5. 决定将所有迁移到.NET 4.5。

All projects are already in VS2012 (C# 5.0) and all projects using async-await keywords 所有项目都已在VS2012(C#5.0)中,所有项目都使用async-await关键字

On .net 4.0 projects is being used Microsoft.Bcl.Async 在.net 4.0项目上正在使用Microsoft.Bcl.Async
On .net 3.5 projects is being used AsyncBridge.Net35 and TaskParallelLibrary 在.net 3.5项目上正在使用AsyncBridge.Net35和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 - .net 4.5中没有TaskEx类和其他扩展方法,或者我不知道这些是否存在

How can I make this change, without major changes in the code? 如何在不对代码进行重大更改的情况下进行此更改?

In .NET 4.5, the TaskEx methods have been moved into the Task class. 在.NET 4.5中, TaskEx方法已移至Task类中。 For example, instead of await TaskEx.Run(...); 例如,而不是await TaskEx.Run(...); , you use await Task.Run(...); ,你使用await Task.Run(...); . You should, assuming your naming scheme of your own classes is sane, be able to do a global search-and-replace. 假设您自己的类的命名方案是理智的,那么您应该能够进行全局搜索和替换。

作为迁移的一部分,您应该将TaskEx调用更改为Task调用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM