Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

35
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda