我想使用 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 namespace
System.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/