protected override void InitializeShell() { base.InitializeShell(); IKernelBuilder builder = Container.Resolve <IKernelBuilder>(); //This is where to register additional lib //builder.OnStarting(b => b.RegisterType<Shell>().AsSelf().As<ICacheManager>().InstancePerLifetimeScope()); builder.UseCaching(c => c.UseMemoryCache()); var hostContainer = builder.Build(); //To make sure every property has its injected value var type = GetType(); var properties = type.GetProperties(); foreach (var property in properties) { var propertyType = property.PropertyType; if (!hostContainer.IsRegistered(propertyType)) { continue; } property.SetValue(this, hostContainer.Resolve(propertyType), null); } //To load the cache manager to manage cache _cacheManager = LifetimeScope.Resolve <ICacheManager>(new TypedParameter(typeof(Type), typeof(Bootstrapper))); var host = hostContainer.Resolve <IHost>(); host.Initialize(); var work = host.CreateStandaloneEnvironment(new ShellSettings { Name = "Default" }); //var form = work.Resolve<Shell>(); App.Current.MainWindow = (Window)Shell; App.Current.MainWindow.Show(); }