public static object GetSharedPropertyValue(this ApplicationSettingsBase settings, string propertyName)
        {
            SettingsProperty property = settings.Properties[propertyName];

            if (property == null)
            {
                throw new ArgumentException(String.Format("The specified property does not exist: {0}", propertyName), "propertyName");
            }

            ISharedApplicationSettingsProvider sharedSettingsProvider = GetSharedSettingsProvider(property.Provider);

            if (sharedSettingsProvider == null)
            {
                return(null);
            }

            var values = sharedSettingsProvider.GetSharedPropertyValues(settings.Context, new SettingsPropertyCollection {
                property
            });
            SettingsPropertyValue value = values[propertyName];

            return(value == null ? null : value.PropertyValue);
        }
        internal static void MigrateSharedSettings(ApplicationSettingsBase settings, string previousExeConfigFilename)
        {
            if (settings is IMigrateSettings)
            {
                IMigrateSettings customMigrator = (IMigrateSettings)settings;
                foreach (SettingsProvider settingsProvider in settings.Providers)
                {
                    ISharedApplicationSettingsProvider sharedSettingsProvider = GetSharedSettingsProvider(settingsProvider);
                    if (sharedSettingsProvider == null || !sharedSettingsProvider.CanUpgradeSharedPropertyValues(settings.Context))
                    {
                        continue;
                    }

                    var properties     = GetPropertiesForProvider(settings, settingsProvider);
                    var previousValues = sharedSettingsProvider.GetPreviousSharedPropertyValues(settings.Context,
                                                                                                properties, previousExeConfigFilename);
                    if (previousValues == null || previousValues.Count == 0)
                    {
                        continue;
                    }

                    var currentValues = sharedSettingsProvider.GetSharedPropertyValues(settings.Context, properties);
                    foreach (SettingsPropertyValue previousValue in previousValues)
                    {
                        SettingsPropertyValue currentValue = currentValues[previousValue.Name];
                        if (currentValue == null)
                        {
                            continue;
                        }

                        MigrateProperty(customMigrator, MigrationScope.Shared, currentValue, previousValue.PropertyValue);
                    }

                    foreach (SettingsPropertyValue property in currentValues)
                    {
                        if (!property.IsDirty)
                        {
                            continue;
                        }

                        sharedSettingsProvider.SetSharedPropertyValues(settings.Context, currentValues);
                        break;
                    }
                }
            }
            else
            {
                foreach (SettingsProvider settingsProvider in settings.Providers)
                {
                    ISharedApplicationSettingsProvider sharedSettingsProvider = GetSharedSettingsProvider(settingsProvider);
                    if (sharedSettingsProvider == null)
                    {
                        continue;
                    }

                    var properties = GetPropertiesForProvider(settings, settingsProvider);
                    sharedSettingsProvider.UpgradeSharedPropertyValues(settings.Context, properties, previousExeConfigFilename);
                }
            }

            SaveIfDirty(settings);
            //Need to call Reload because changes to shared settings aren't automatically realized by the .NET settings framework.
            settings.Reload();
        }