System.TypeLoadException: 'Could not load type 'Microsoft.AspNetCore.Mvc.MvcJsonOptions' from assembly 'Microsoft.AspNetCore.Mvc.Formatters.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.'
Here I am using Microsoft.AspNetCore.Mvc.Formatters.Json, latest version 2.1.18 that is available in NuGet. But in error it's showing Version=8.0.0.0
Microsoft.AspNetCore.Mvc.Formatters.Jsonin the first place? It's almost certain you don't need it. Are you trying to migrate some old ASP.NET or ASP.NET Core project to ASP.NET Core 8 ? That package was deprecated in .NET Core 3.0