0

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

3
  • 1
    What version of dotnet are you using? Microsoft.AspNetCore.Mvc.Formatters.Json - this package has been deprecated Commented Dec 18, 2024 at 12:23
  • Why do you want to use Microsoft.AspNetCore.Mvc.Formatters.Json in 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 Commented Dec 18, 2024 at 13:05
  • I am trying to migrate from .Net Core WebApi 2.1 project to .Net Core WebApi 8.0 Commented Dec 19, 2024 at 6:51

1 Answer 1

0

this can happen due to version conflicts or missing dependencies for kindly check following #1 check your csproj file and ensure that there are no conflicting versions for the Microsoft.AspNetCore.Mvc.Formatters.Json #2 if there is any existing dependencies for Microsoft.AspNetCore.Mvc.Formatters.Json then remove the dependency.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.