C# 如何在mono中引用HttpClient?
我想用mono编译并运行下面的文件,但是我得到了编译错误C# 如何在mono中引用HttpClient?,c#,mono,C#,Mono,我想用mono编译并运行下面的文件,但是我得到了编译错误 dmcs test.cs -r:System.Net.Http 错误CS0006:找不到元数据文件'System.Net.http' 编译失败:1个错误,0个警告 test.cs(1,18):错误CS0234:命名空间System.Net'中不存在类型或命名空间名称Http'。是否缺少'System.Net.Http'程序集引用 来源 using System.Net.Http; public class Hello1 { pu
dmcs test.cs -r:System.Net.Http
错误CS0006:找不到元数据文件'System.Net.http'
编译失败:1个错误,0个警告
test.cs(1,18):错误CS0234:命名空间System.Net'中不存在类型或命名空间名称Http'。是否缺少'System.Net.Http'程序集引用
来源
using System.Net.Http;
public class Hello1
{
public static void Main()
{
HttpClient c;
}
}
在我的Ubuntu14.04上,默认SDK是4.0,但是System.Net.Http
在4.5版中可用
dmcs Program.cs -r:System.Net.Http -sdk:4.5
或者从MonoDevelop:ProjectOptions->Build->General->targetframework:Mono/.net4.5
您需要添加一个程序集引用。为什么使用命令行?你不能安装MonoDevelop/Xamarin Studio吗?@LexLi也许我会在虚拟机上安装它,但要找到引用名称有点过分了。我正在我的PI上编译代码。一年前,我在我的pi上运行了它,但是IDR我使用的参考,我可能已经在我的旧笔记本上安装了mono,我不再有交叉编译,所以我认为你不必在pi上工作。
dmcs Program.cs -r:System.Net.Http -sdk:4.5