ASP.NET Core 1.0 - dynamically load assemblies in a web application

I have an asp.net core 1.0 MVC modular web application and I want to load assemblies dynamically when the application starts. If I put the assembly in the root application (all the other assemblies are there), everything will be fine, but I do not want to copy the assemblies to the root folder, instead I want to load them from different folders.

I tried everything I found on google / stackoverflow and so far nothing works:

  • Assembly.Load
  • mvcBuilder.AddApplicationPart(moduleAssembly);
  • DependencyContext.Load(moduleAssembly);
  • DefaultAssemblyProvider - apparently they removed it in asp.net core 1.0 and replaced it with .AddApplicationPart()

I can’t understand why all this does not work and why? Any suggestion what else can I try?

EDIT (more)

I have a modular web application. The main .dll module is dependent on the class library (which is also part of the module solution). I am adding the main module assembly using AddApplicationPart , but I cannot succeed in the specified class library. I get Could not load file or assembly ... or one of its dependencies (in this case there is only mscorlib ). Only when I put the assembly link in the root web application does it work, which is not what I want.

+5
source share

All Articles