Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

47
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda