c# - 如何在单声道中引用 HttpClient?

标签 c# mono

我想使用 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

关于c# - 如何在单声道中引用 HttpClient?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43010778/

相关文章:

c# - 在 Mac OS X 中运行 Mono 应用程序

.net - 我们可以使用在 Windows 平台上编译的 .NET 程序集,并在 Linux 上使用 mono 依赖 Winsock 吗

ios - Xamarin iOS 绑定(bind) : Could not initialise an instance of the type, 返回 nil

c# - select 子句中的表达式类型不正确。调用 'Select' 时类型推断失败

C# - DataGridView - 同一行上的图像和文本

c# - 自动化 UI 测试大型 c# 表单应用程序

c# - Mono Assembly 未解决

c# - JContainer、JObject、JToken和Linq混淆

c# - 一行中的两个相等(赋值)运算符

Android 内存泄漏 - 无法正确解除分配位图,内存不足错误 - 位图大小超出 VM 预算 [Mono Android]