2

I am in the process of migrating an application from dotnetcore2.0 to 3.1 and I am facing some issues with the newtonsoft dependency.

services.AddAuthorization()
                .AddApiExplorer()
                .AddMvcOptions(option => option.EnableEndpointRouting = false)
                .AddNewtonsoftJson(n =>
                {
                    n.SerializerSettings.Converters.Add(new StringEnumConverter());
                    n.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
                    n.SerializerSettings.NullValueHandling = NullValueHandling.Ignore;
                })
                .AddDataAnnotations();
2
  • Could you please clarify which problems you have to solve? Commented Oct 21, 2021 at 8:05
  • When I try to debug the application, I am getting this error "Could not load type 'Microsoft.AspNetCore.Mvc.MvcJsonOptions'" from the module `` BuildWebHost(args).Run(); Commented Oct 21, 2021 at 8:59

1 Answer 1

1

If I get it right the issue is caused by Swashbuckle 4 used in a .Net Core 3-Environment. What you can do to solve this is to upgrade to Swashbuckle 5. (use command install-package Swashbuckle.AspNetCore).

I found this answer here: Check this answer

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.