79587544

Date: 2025-04-22 22:32:52
Score: 1.5
Natty:
Report link

Replace:

builder.Services.AddControllers()

with

var assembly = typeof(WeatherForecastController).Assembly;
builder.Services.AddControllers()
       .PartManager.ApplicationParts.Add(new AssemblyPart(assembly));

See also: "How to use a controller in another assembly in ASP.NET Core MVC 2.0 ?"

Reasons:
  • Probably link only (1):
  • Low length (0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
Posted by: ShamilS