I have the following simple Web API controller:
// GET: api/customers
[HttpGet]
public async Task Get()
{
var
For Core 2.x versions, the only thing that you need to do is to have the following code inside the ConfigureServie method of Startup.cs file.
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc()
.AddMvcOptions(o => o.OutputFormatters.Add(
new XmlDataContractSerializerOutputFormatter()));
}
You need to reference the Microsoft.AspNetCore.Mvc.Formatters.