Clr dll .net control

本文关键字:control net dll Clr | 更新日期: 2023-09-27 18:36:12

我需要从 C# winforms 主机项目在运行时从 DLL 动态加载一些 .NET 控件。

例如:

1.dll约束控制1

2.dll约束控制2

3.dll约束控制3

主机应用可以加载任何此DLL-s,从DLL获取控件并将其置于自表单上。

我试过了:

__declspec(dllexport) TestCLRPlugin::Properties ^ GetControl()
{
    return gcnew TestCLRPlugin::Properties();
}

但是,CLRCALL 方法不能从 DLL 导出。

Clr dll .net control

你需要使用

Assembly.LoadFrom 方法,然后你可以使用反射从程序集中获取你想要的方法/类/等。 如果您遵循 MSDN 链接,则有很好的例子。

我不确定你要找什么,但你可能想阅读反思,这使得这很容易:

http://msdn.microsoft.com/en-us/library/ms173183(v=vs.80).aspx

对不起,如果您已经熟悉或这没有帮助。