'Could not load type 'Microsoft.AspNetCore.Mvc.MvcJsonOptions' from assembly 'Microsoft.AspNetCore.Mvc.Formatters.Json, Version=3.0.0.0

I'm not sure if this solves OP's problem, but this error also occurs when you use Swashbuckle 4 in .Net Core 3. The solution is to use Swashbuckle 5. i.e.

<PackageReference Include="Swashbuckle.AspNetCore" Version="5.0.0" />

Then you'll need to upgrade it in Startup.cs. Generally that involves prefixing classes that don't compile with OpenApi e.g.

options.SwaggerDoc("v1" new Info ...

becomes

options.SwaggerDoc("v1", OpenApiInfo

Also OpenApiSecurityScheme becomes ApiKeyScheme

See also docs at https://github.com/domaindrivendev/Swashbuckle.AspNetCore


The reason you're getting the error is because MvcJsonOptions was removed in .NET Core 3.0; you can read more about the breaking changes here.


netstandard2.1 to netcoreapp3.0 MvcJsonOptions -> MvcNewtonsoftJsonOptions

public IServiceProvider ConfigureServices(IServiceCollection services)
{
            //MVC
            services.AddControllersWithViews(options =>
            {
            }).AddNewtonsoftJson();

            services.PostConfigure<MvcNewtonsoftJsonOptions>(options => {
                options.SerializerSettings.ContractResolver = new MyCustomContractResolver()
                {
                    NamingStrategy = new CamelCaseNamingStrategy()
                };
                options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
            });
}