<PackageReference Include="Castle.Windsor" Version="2.5.4" />

ConfigurationInstaller

using Castle.MicroKernel.Registration; using Castle.MicroKernel.SubSystems.Configuration; using Castle.Windsor.Configuration; using System; namespace Castle.Windsor.Installer { public class ConfigurationInstaller : IWindsorInstaller { private readonly IConfigurationInterpreter interpreter; private EnvironmentDelegate environment; public ConfigurationInstaller(IConfigurationInterpreter interpreter) { if (interpreter == null) throw new ArgumentNullException("interpreter"); this.interpreter = interpreter; } public ConfigurationInstaller Environment(string environmentName) { return Environment(() => environmentName); } public ConfigurationInstaller Environment(EnvironmentDelegate environment) { this.environment = environment; return this; } void IWindsorInstaller.Install(IWindsorContainer container, IConfigurationStore store) { if (environment != null) interpreter.EnvironmentName = environment(); interpreter.ProcessResource(interpreter.Source, store); } } }