title: HttpClient object method missing
body: <p>I am separating some code out of a website and after copying the code behind for the particular page in question, I'm getting an error on the <code>PostAsJsonAsync()</code> line of code:</p>
  
  <pre><code>HttpResponseMessage response = await client.PostAsJsonAsync("api/...", user);
  </code></pre>
  
  <p>which is in this using statement (added headers as well)</p>
  
  <pre><code>        using System;
          using System.Net.Http;
          using System.Net.Http.Headers;
          using System.Net.Mail;
          using System.Threading.Tasks;
          //...
  
          using (var client = new HttpClient())
          {
              client.BaseAddress = new Uri("WebServiceAddress");
              client.DefaultRequestHeaders.Accept.Clear();
              client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
  
              HttpResponseMessage response = await client.PostAsJsonAsync("api/...", user);
              if (response.IsSuccessStatusCode)
              {
                  const string result = "Thank you for your submission.";
                  return result;
              }
              //...
          }
  </code></pre>
  
  <p>The error I get says</p>
  
  <pre><code> Error  4   'System.Net.Http.HttpClient'
   does not contain a definition for 'PostAsJsonAsync' and no extension
   method 'PostAsJsonAsync' accepting a first argument of type 'System.Net.Http.HttpClient'
   could be found (are you missing a using directive or an assembly reference?)
  </code></pre>
  
  <p>even though it works in the former project and was copied straight over from that project in its entirety. Did I forget to add something?</p>
  
  <p>I appreciate any help on the matter.</p>