I am creating some small web applications that will be running on my local home network and in that respect I thought I'd create a standard assembly with the default setup for my applications, so that a new web application project would be a single line of code in Program.cs + my controllers.
This doesn't seem to work since ASP.NET Core MVC seems to only look for controllers in the same assembly as the one that contains the startup class, when I use this type of code:
public static Task Main(string[] args)
{
return WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.Build()
.RunAsync();
}
If I define the Startup
class in the class library, then no controllers are found, unless I move them as well.
Now, I don't have to use Startup
, but how do I tell ASP.NET Core MVC framework which assembly(ies) that contain my controllers?