Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

44
Views
Could not load type 'Microsoft.AspNetCore.Mvc.MvcJsonOptions' from assembly 'Microsoft.AspNetCore.Mvc.Formatters.Json

Net core 2.2 to .Net 8.0 project. I am getting the following error. I am using the Visual Studio 2022 Upgrade Assistant.

(Same problem if I update to version 3.2)

Application Startup Exception: 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'.

in System.Signature.GetSignature(Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType)

at System.Reflection.RuntimeConstructorInfo.<get_Signature>g__LazyCreateSignature|21_0()

in System.Reflection.RuntimeConstructorInfo.GetParametersNoCopy()

in System.Reflection.RuntimeConstructorInfo.GetParameters()

at Microsoft.Extensions.Internal.ActivatorUtilities.CreateInstance(IServiceProvider provider, instance type, object parameters[])

at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.ReflectionMiddlewareBinder.CreateMiddleware (RequestDelegate below)

at Microsoft.AspNetCore.Builder.ApplicationBuilder.Build ()

in Microsoft.AspNetCore.Hosting .WebHost.BuildApplication()

I have updated to the Microsoft.AspNetCore.Mvc.NewtonsoftJson nuget package - 8.0.2

I also tried adding the following code in startup.cs services.AddMvc(options => options.EnableEndpointRouting = false)

.AddNewtonsoftJson();

and

 services.AddControllers()

.AddNewtonsoftJson();

I'm not sure why it's still looking for the old nuget package and the Microsoft.AspNetCore.Mvc.MvcJsonOptions assembly from version 2.2.

When I tried to find the old Microsoft.AspNetCore.Mvc.MvcJsonOptions assembly in the project folder, I found it in the test project in the bin\Debug\net8.0\refs folder. I tried to remove it but it is adding it again in the build.

I have updated to the Microsoft.AspNetCore.Mvc.NewtonsoftJson nuget package - 8.0.2

I also tried adding the following code in startup.cs services.AddMvc(options => options.EnableEndpointRouting = false)

.AddNewtonsoftJson();

and

 services.AddControllers()

.AddNewtonsoftJson();

I'm not sure why it's still looking for the old nuget package and the Microsoft.AspNetCore.Mvc.MvcJsonOptions assembly from version 2.2.

over 2 years ago · Carlos Garzón Colorado
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!