I need to dynamic loading some .NET control from DLL in runtime from C# winforms host project.
for example:
1.dll contrains control1
2.dll contrains control2
3.dll contrains control3
host app may load any of this dll-s, get controls from dll and put it on self form.
I tried:
__declspec(dllexport) TestCLRPlugin::Properties ^ GetControl()
{
return gcnew TestCLRPlugin::Properties();
}
but, clrcall methods can’t be exported from dll.
You need to use the Assembly.LoadFrom methods and then you can use reflection to get the method/class/etc you want from the assembly. There are pretty good examples if you follow the MSDN link.