我使用visual studio代码在OS X上,并尝试使用带有dnxcore50的System.Net.Http发出HTTP请求。当我运行mcs -debug Program.cs
时,我收到了消息:
Program.cs(2,18):错误CS0234:名称空间“System.Net”中不存在类型或命名空间名称“Http”。你错过了'System.Net.Http'汇编参考吗?`
这是我的project.json:
{
"version": "1.0.0-*",
"description": "Console Application",
"authors": [
"your name"
],
"tags": [
""
],
"projectUrl": "",
"licenseUrl": "",
"dependencies": {
"Newtonsoft.Json": "7.0.1",
"System.Net.Http": "4.0.1-beta-23217",
"Microsoft.AspNet.WebApi.Client": "5.2.3"
},
"commands": {
"ConsoleApplication": "ConsoleApplication"
},
"frameworks": {
"dnx451": {},
"dnxcore50": {
"dependencies": {
"Microsoft.CSharp": "4.0.1-beta-23217",
"System.Collections": "4.0.11-beta-23217",
"System.Console": "4.0.0-beta-23217",
"System.Linq": "4.0.1-beta-23217",
"System.Threading": "4.0.11-beta-23217"
}
}
}
答案 0 :(得分:0)
如果您使用DNX,那么您不能直接调用C#编译器。麦克斯并不知道如何编译新项目。您应该使用dnu build
代替:
dnu build <path to your project.json>