I am trying to use the new HttpClient
in .NET 4.5, but Visual Studio complains that it doesn't exist. I have System.Net
, but when I type System.Net.Http
, it complains for that too.
Am I supposed to download a new distributable for this class?
Join Stack Overflow to learn, share knowledge, and build your career.
I am trying to use the new HttpClient
in .NET 4.5, but Visual Studio complains that it doesn't exist. I have System.Net
, but when I type System.Net.Http
, it complains for that too.
Am I supposed to download a new distributable for this class?
Add a reference to System.Net.Http
:
I had the same problem. After some digging around, i found you had to install this package and then add the reference to System.Net.Http
for it to not complain!
I encountered the issue when I added a class inside the App_Code
folder having this HttpClient
called in one of my function. Upon spending countless hours I found that the Build Action
under Properties
for my class is set to Content
.
Changing this Build Action
to Compile
fixed the problem.
System.Net.Http
assembly. Also, PCLs don't support using that class, so you're out of luck if that's what you're trying to do. – dlev May 1 '13 at 21:16