如何在单声道中引用 HttpClient?

How do I reference HttpClient in mono?

我想使用单声道编译和运行下面的文件,但出现编译错误

dmcs test.cs -r:System.Net.Http

error CS0006: Metadata file `System.Net.http' could not be found Compilation failed: 1 error(s), 0 warnings

dmcs test.cs -r:System.Net

test.cs(1,18): error CS0234: The type or namespace name Http' does not exist in the namespaceSystem.Net'. Are you missing `System.Net.Http' assembly reference?

来源

using System.Net.Http;
public class Hello1
{
    public static void Main()
    {
        HttpClient c;
    }
}

在我的 Ubuntu 14.04 上,默认 SDK 是 4.0,但是 System.Net.Http 在 4.5 版本中可用。

dmcs Program.cs -r:System.Net.Http -sdk:4.5

或来自 MonoDevelop:ProjectOptions->Build->General->Target framework:Mono/.NET 4.5