从温莎城堡的目录中检索 DLL

本文关键字:检索 DLL 城堡 | 更新日期: 2023-09-27 17:55:46

我目前有一个"PlugInFolder"文件夹,我想在其中将我的自定义插件复制为DLL库。每个插件都实现了我的"IPlugIn"接口。

我想在温莎城堡运行时检索它们。

我尝试过这样的事情但没有结果:

CastleContainer.Instance
       .Install(
        FromAssembly.InDirectory(new AssemblyFilter("PlugInFolder"))
         );
      CastleContainer.Instance.Register(Component.For<IPlugIn>());

       IPlugIn[] plugIn= CastleContainer.Instance.ResolveAll<IPlugIn>();  

我收到此错误:

Type ImageEditorInterfaces.IPlugIn is abstract.
As such, it is not possible to instansiate it as implementation of service ImageEditorInterfaces.IPlugIn.

从温莎城堡的目录中检索 DLL

尝试这样的事情:

container.Register(AllTypes
    .FromAssemblyInDirectory(new AssemblyFilter("PlugInFolder"))
    .BasedOn<IPlugIn>());