New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CS1061 'HttpClient' does not contain a definition for 'PostAsJsonAsync' For asp.net core project #3849
Comments
I'm guessing the sample is missing a using statement. |
@Rick-Anderson I am not sure if it is because of a missing using statement. I believe it is something else, below are the using statements
|
@Rick-Anderson I just read this Where is PostAsJsonAsync method in ASP.NET Core? So, I call end up unreference WinInsider.System.Net.Http.Formatting, but calling JsonConvert.SerializeObject(); first then call PostAsync instead. My problem is solved, but I am not sure if I should close this issue, so please close it if you see fit. Thanks |
|
In this case the sample includes its own implementation of |
I'm new here, I was pretty confused following that tutorial (Call a Web API From a .NET Client (C#)) using System.Web.Script.Serialization;
|
Hi! |
correct answer.thanks |
Not sure if the is the right place to post this issue.
When try to following the Doc for "Integration Testing" example https://github.com/aspnet/Docs/tree/master/aspnetcore/mvc/controllers/testing/sample, for a pure asp.net core project, I got the following error.
CS1061 'HttpClient' does not contain a definition for 'PostAsJsonAsync'
Here are the nudge package was including.
I have to add the package below to make it to work.
<PackageReference Include="WinInsider.System.Net.Http.Formatting" Version="1.0.5" />
But this does not seem right because the "TestingControllersSample" does not need to include it.
Is this a packing versioning problem? The "TestingControllersSample" is using "System.Net.Http Version"4.1.1"
Thanks
The text was updated successfully, but these errors were encountered: