How to use a controller in another assembly in ASP.NET Core MVC 2.0?

Inside the ConfigureServices method of the Startup class you have to call the following:

services.AddMvc().AddApplicationPart(assembly).AddControllersAsServices();

Where assembly is the instance Assembly representing Contoso.School.UserService.dll.

You can load it either getting it from any included type or like this:

var assembly = Assembly.Load("Contoso.School.UserService");

Leave a Comment