0

I am trying out the Visual Studio Code editor. I have it installed on my MacBook Pro.

I have created a WebApi project and can get it to run. I wish to call out to an external API but can't seem to instantiate a new WebClient object.

I get the following when running the web server.

DNXCore,Version=v5.0 error CS0234: The type or namespace name 'WebClient' does not exist in the namespace 'System.Net' (are you missing an assembly reference?)

I have no idea how to reference it. I have tried the using System.Net;, as well as, System.Net.WebClient in my controller method.

I am sure I am missing something simple but I just don't know what I need to do with using a full fledged version of Visual Studio.

cskwrd
  • 2,803
  • 8
  • 38
  • 51
  • Did you add a reference to System.Net @ the project level? – Tdorno Feb 27 '16 at 03:27
  • @Tdorno I'm guessing no. I didn't do anything myself and I can't find any documentation on how to do that in Visual Studio Code. – cskwrd Feb 27 '16 at 03:33
  • You reference it in the [project.json file](https://github.com/aspnet/Home/wiki/Project.json-file). Although I'm not sure if WebClient is in .NET Core. [HttpClient is](https://github.com/dotnet/corefx/blob/master/src/System.Net.Http/src/System/Net/Http/HttpClient.cs). – mason Feb 27 '16 at 03:51

0 Answers0