Hey, I'm working on an API. I want to map HttpResponseMessage object's Content field into a domain model. I know I can do by ReadAsStringAsync then deserialize it but I don't really want, that much work for simple mapping. I've couldn't found yet but are there any alternatives for that?
I can't suppress the warning since it's a blocker on deployment side.
Summary of process:
c#
var taskResult= await _httpRequestService.GetAsync();
var searchResult = await taskResult.Content.ReadAsAsync<MyModel>();
Package 'System.Net.Http.Formatting.Extension 5.2.3' was restored using .NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.2'.
The package System.Net.Http.Formatting.Extension that you seem to be using is not from Microsoft. I believe you should use the Microsoft.AspNet.WebApi.Client package instead, which should support .Net Core 2.x.
Looks like problem with external 3rd party NuGet package, closing. Thanks @svick for your analysis.
If you find a repro without it, please let us know and we can reopen.
Super catch!
I thought it was a built-in class and didn't verify.
Thanks. @karelz @svick
Most helpful comment
Super catch!
I thought it was a built-in class and didn't verify.
Thanks. @karelz @svick