【发布时间】:2019-05-06 16:13:48
【问题描述】:
我需要使用面向 .Net-4.0 的库运行 Nito.AsyncEx。我正在尝试以下简单代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TempNet40
{
class Program
{
static void Main(string[] args)
{
Nito.AsyncEx.AsyncContext.Run(() => MainAsync(args));
}
static async void MainAsync(string[] args)
{
}
}
}
虽然当我的 lib 以 .Net-4.5 或更高版本为目标时,上述编译 - 它对于 .Net-4.0 失败并出现错误:
类型或命名空间名称“AsyncContext”不存在于 命名空间“Nito.AsyncEx”(您是否缺少程序集引用?)
Nito.AsyncEx(以及它的 .Net-4.0 依赖项:Microsoft.Bcl.Async)是使用 NuGet 安装的 - 我猜对于 .Net-4.0,我需要引用另一个库...有人知道哪个库吗? ?
【问题讨论】:
标签: c# .net asynchronous .net-4.0