Reputation: 2996
I am trying to create first sample application running with ASP.NET 5 on OS X. However I just can't figure out how project.json dependencies work. I generated Web Api Application with yeoman and everything had worked fine until I've tried to use WebClient. According to dnvm list I'm running:
* 1.0.0-rc1-update2 mono linux/osx
And while restore packages goes well the project fails at build step. Here is my project.json file:
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true
},
"tooling": {
"defaultNamespace": "LocationService"
},
"dependencies": {
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
"Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
"Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
"Microsoft.Extensions.Configuration.FileProviderExtensions": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final"
},
"commands": {
"web": "Microsoft.AspNet.Server.Kestrel"
},
"frameworks": {
"dnx451": {
"dependencies": {
"System.Web.Http": "4.0.0"
}
},
"dnxcore50": {
}
},
"exclude": [
"wwwroot",
"node_modules",
"bower_components"
],
"publishExclude": [
"**.user",
"**.vspscc"
]
}
And project fails on build with unresolved reference:
LocationService/Controllers/ValuesController.cs(32,40):
DNXCore,Version=v5.0 error CS0246: The type or namespace name
'WebClient' could not be found (are you missing a using directive or an
assembly reference?)
I've tried add dependency both under dnxcore50 and dnx451. Dmvm tells me that I can use coreclr x64 but it seems just not works in my case - ends up with numerous unresolved references during build.
Upvotes: 0
Views: 105
Reputation: 4360
WebClient is not available (yet?) for dnxcore.
Try removing dnxcore50 framework or use HttpClient or HttpWebRequest instead of WebClient.
Upvotes: 1