public void OnImportsSatisfied() { if (this.Capabilities == null) { return; } foreach (IPlatformCapabilitySettings capabilitySettings in this.Capabilities) { try { if (capabilitySettings.Version != 1) { throw new ArgumentOutOfRangeException(typeof(IPlatformCapabilitySettings).ToString() + ".Version"); } PlatformCapabilitySettings settings = new PlatformCapabilitySettings(capabilitySettings.RequiredTargetFramework, capabilitySettings.MaxFrameworkVersion); foreach (string index in (IEnumerable <string>)capabilitySettings.Capabilities.Keys) { PlatformCapability result; if (Enum.TryParse <PlatformCapability>(index, true, out result)) { settings.AddCapability(result, capabilitySettings.Capabilities[index]); } } PlatformTypes.AddCapabilitySettings(settings); } catch (Exception ex) { IExpressionMefHostingService service = this.services.GetService <IExpressionMefHostingService>(); if (service != null) { service.AddCompositionException(ex); } else { throw; } } } }