Using xml-config file for dynamic loading of plugin dll doesn't work in Net6
AndreyPolovodov opened this issue · 1 comments
I have been using Windsor container with config via new WindsorContainer("path_to_config") for a while in NetFramework till we've decided migrate to Net6. And in Net6 it doesn't work anymore. I can load class from dll only if that dll is referenced from my program.
If I remove reference - I get error
Exception: Castle.MicroKernel.SubSystems.Conversion.ConverterException: Could not convert string 'ClassLibrary.TestClass, ClassLibrary' to a type. Assembly was not found. Make sure it was deployed and the name was not mistyped.
at Castle.MicroKernel.SubSystems.Conversion.TypeNameConverter.GetType(String name)
at Castle.MicroKernel.SubSystems.Conversion.TypeNameConverter.PerformConversion(String value, Type targetType)
at Castle.MicroKernel.SubSystems.Conversion.DefaultConversionManager.PerformConversion(String value, Type targetType)
at Castle.MicroKernel.SubSystems.Conversion.DefaultConversionManager.PerformConversion[TTarget](String value)
at Castle.Windsor.Installer.DefaultComponentInstaller.GetType(IConversionManager converter, String typeName)
at Castle.Windsor.Installer.DefaultComponentInstaller.SetUpComponents(IConfiguration[] configurations, IWindsorContainer container, IConversionManager converter)
at Castle.Windsor.Installer.DefaultComponentInstaller.SetUp(IWindsorContainer container, IConfigurationStore store)
at Castle.Windsor.WindsorContainer.Install(IWindsorInstaller[] installers, DefaultComponentInstaller scope)
at Castle.Windsor.WindsorContainer.Install(IWindsorInstaller[] installers)
That is a client code:
try
{
var container = new WindsorContainer();
container.Install(Configuration.FromXmlFile("config.xml"));
var driver = container.Resolve<IDriver>();
driver.Start();
}
catch (Exception ex)
{
Console.WriteLine($"Exception: {ex}!");
}
That is a config.xml file:
<components>
<component id="ViaQuatroIntegrationDriver" service="CommonClassLibrary.IDriver, CommonClassLibrary" type="ClassLibrary.TestClass, ClassLibrary">
<parameters>
</parameters>
</component>
</components>
If I add reference to ClassLibrary.dll - all works as expected.
I'm using Castle.Windsor 5.1.2 from nuget
I've tried to examine source code and didn't find any tries to load dll from config dinamically.
So, is that a changed behavior? Or, may be, I missed some special option/property/whatever? Is it still possible to load dll dynamically via config file, without reference to dll?