You can use a custom XmlInterpreter to initialize your container with.
Create a class that inherits XmlInterpreter and put the following override in that class:
This one processes all *.dll.config in the directory of the current executing assembly, which easily could be rewritten to use a recursive file lookup of some kind.
public override void ProcessResource( Castle.Core.Resource.IResource source, Castle.MicroKernel.IConfigurationStore store )
{
base.ProcessResource( source, store );
var baseDir = Path.GetDirectoryName( Assembly.GetExecutingAssembly().Location );
foreach( var extraConfig in Directory.GetFiles( baseDir, "*.dll.config" ) )
{
try
{
var interpreter = new XmlInterpreter( extraConfig ) { Kernel = Kernel };
interpreter.ProcessResource( interpreter.Source, store );
}
catch(ConfigurationErrorsException)
{
throw;
}
catch( Exception ex )
{
throw new InvalidOperationException( "Failed to load configuration: " + extraConfig, ex );
}
}
}