static NuPatternGlobalContainer() { var globalComponentModel = (IComponentModel)Package.GetGlobalService(typeof(SComponentModel)); if (globalComponentModel == null) { tracer.Warn(Resources.NuPatternGlobalContainer_TraceNoComponentModelService); } else { var catalog = globalComponentModel.GetCatalog(NuPattern.ComponentModel.Composition.Catalog.DefaultCatalogName); if (catalog == null) { tracer.Warn(Resources.NuPatternGlobalContainer_TraceNoComponentModel, NuPattern.ComponentModel.Composition.Catalog.DefaultCatalogName); } else { try { // // Create our DecoratingReflectionCatalog // var componentsCatalog = new ComponentCatalog(catalog); // // Now create a catalog provider // CatalogExportProvider catalogProvider = new CatalogExportProvider(componentsCatalog); // // have it inherit the global provider // catalogProvider.SourceProvider = globalComponentModel.DefaultExportProvider; // // Create provider settings to look here first and then include others when not found // var providerSettings = new VsExportProviderSettings( VsExportProvidingPreference.BeforeExportsFromOtherContainers, VsExportSharingPolicy.IncludeExportsFromOthers); //Instance = VsCompositionContainer.Create(componentsCatalog, providerSettings); Instance = new CompositionContainer(componentsCatalog, globalComponentModel.DefaultExportProvider); } catch (Exception ex) { tracer.Error(ex, Resources.NuPatternGlobalContainer_TraceFailedContainerInitialization); throw; } } } }