I'm trying to load an assembly and create classes from it dynamically. This is the code:
assembly = Assembly.Load(assemblyName);
var type = assembly.GetType(assemblyName + ".MessageProcessor");
var processor = (IMessageProcessor)Activator.CreateInstance(type);
processor.Process();
The problem is that the assembly name belongs to an assembly that is not referenced in the project. I deploy it manually to the execution folder.
But I receive this error:
Could not load file or assembly 'AssemblyNameToLoad, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
I can't manually add all of these files to deps.json
. Is there a way to make .NET Core load assembly in spite of not being present in deps.json
file?