Is it possible to instantiate an object at runtime if I only have the DLL name and the class name, without adding a reference to the assembly in the project? The class implements a interface, so once I instantiate the class, I will then cast it to the interface.
Assembly name:
library.dll
Type name:
Company.Project.Classname
EDIT: I dont have the absolute path of the DLL, so Assembly.LoadFile
won't work. The DLL might be in the application root, system32, or even loaded in the GAC.
Activator.CreateInstance ought to work.
Note: The type name must be the fully qualified type.
Example: