I want to load a DLL from different paths from executing directory and resolve from this DLL. But Castle.Windsor throw this exception
Castle.MicroKernel.SubSystems.Conversion.ConverterException: 'Could not convert string 'EngineA.AClass, EngineA' to a type. Assembly EngineA, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null was matched, but it doesn't contain the type. Make sure that the type name was not mistyped.'
at Castle.MicroKernel.SubSystems.Conversion.TypeNameConverter.GetType(String name) in C:\Users\name\Source\Repos\Windsor\src\Castle.Windsor\MicroKernel\SubSystems\Conversion\TypeNameConverter.cs:line 125
at Castle.MicroKernel.SubSystems.Conversion.TypeNameConverter.PerformConversion(String value, Type targetType) in C:\Users\name\Source\Repos\Windsor\src\Castle.Windsor\MicroKernel\SubSystems\Conversion\TypeNameConverter.cs:line 72
at Castle.MicroKernel.SubSystems.Conversion.DefaultConversionManager.PerformConversion(String value, Type targetType) in C:\Users\name\Source\Repos\Windsor\src\Castle.Windsor\MicroKernel\SubSystems\Conversion\DefaultConversionManager.cs:line 106
at Castle.MicroKernel.SubSystems.Conversion.DefaultConversionManager.PerformConversion[TTarget](String value) in C:\Users\name\Source\Repos\Windsor\src\Castle.Windsor\MicroKernel\SubSystems\Conversion\DefaultConversionManager.cs:line 134
at Castle.Windsor.Installer.DefaultComponentInstaller.GetType(IConversionManager converter, String typeName) in C:\Users\name\Source\Repos\Windsor\src\Castle.Windsor\Windsor\Installer\DefaultComponentInstaller.cs:line 228
at Castle.Windsor.Installer.DefaultComponentInstaller.SetUpComponents(IConfiguration[] configurations, IWindsorContainer container, IConversionManager converter) in C:\Users\name\Source\Repos\Windsor\src\Castle.Windsor\Windsor\Installer\DefaultComponentInstaller.cs:line 183
at Castle.Windsor.Installer.DefaultComponentInstaller.SetUp(IWindsorContainer container, IConfigurationStore store) in C:\Users\name\Source\Repos\Windsor\src\Castle.Windsor\Windsor\Installer\DefaultComponentInstaller.cs:line 50
at Castle.Windsor.WindsorContainer.Install(IWindsorInstaller[] installers, DefaultComponentInstaller scope) in C:\Users\name\Source\Repos\Windsor\src\Castle.Windsor\Windsor\WindsorContainer.cs:line 323
at Castle.Windsor.WindsorContainer.Install(IWindsorInstaller[] installers) in C:\Users\name\Source\Repos\Windsor\src\Castle.Windsor\Windsor\WindsorContainer.cs:line 453
at Reflection.Program.Main(String[] args) in C:\Users\name\Source\Repos\Reflection\Reflection\Program.cs:line 26
public static void Main(string[] args)
{
IWindsorContainer container = new WindsorContainer();
//container.Install(FromAssembly.InDirectory(new AssemblyFilter("C:\\Users\\name\\Source\\Repos\\Reflection\\EngineA\\bin\\Release"))); // dll in this directory
container.Install(Configuration.FromXmlFile("C:\\Users\\name\\Source\\Repos\\Reflection\\Reflection\\CastleInstallerConfig.xml")); // xml path. throw exception from this
IClass aa = container.Resolve<IClass>();
string res = aa.DoSomethings();
Console.WriteLine(res);
}
Class and interface are as follows:
// It's in the EngineA.dll
namespace EngineA
{
public class AClass: IClass
{
public string DoSomethings()
{
return "FromEngineA";
}
}
}
It's in Reflection.exe
namespace Reflection
{
public interface IClass
{
string DoSomethings();
}
}
When I moved Engine.dll to the same folder as Reflection.exe , it can be work and not throw exception.
Hi,
I want to load a DLL from different paths from executing directory and resolve from this DLL. But Castle.Windsor throw this exception
It is XML config file:
It's main method
Class and interface are as follows:
When I moved Engine.dll to the same folder as Reflection.exe , it can be work and not throw exception.