P
Paul
(This is all motivated by problems with Vista file protection. Get rid of Vista and boom, no problems, the users can edit the config files as always.)
I want to modify settings for an application. The application settings are in custom sections created by visual studio, <applicationSettings> for example. These are the project settings in Settings.settings.
I have yet to find a way to modify and save these settings from another app. You get part way into the the configuration namespaces and the API just shuts you down. There is no way to edit the settings. Do you know of any sample code to edit the settings in another app?
This code lets me delete a section, but this is clearly not what I want to do. I want to edit the values in the section.
ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap();
fileMap.ExeConfigFilename = @"SomeOtherApp.exe.config";
Configuration config = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);
ConfigurationSection mySection = config.GetSection("applicationSettings");
config.SectionGroups.Clear();
config.Save(ConfigurationSaveMode.Full);
I've yet to see any sample code that performs this obvious function.
I want to modify settings for an application. The application settings are in custom sections created by visual studio, <applicationSettings> for example. These are the project settings in Settings.settings.
I have yet to find a way to modify and save these settings from another app. You get part way into the the configuration namespaces and the API just shuts you down. There is no way to edit the settings. Do you know of any sample code to edit the settings in another app?
This code lets me delete a section, but this is clearly not what I want to do. I want to edit the values in the section.
ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap();
fileMap.ExeConfigFilename = @"SomeOtherApp.exe.config";
Configuration config = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);
ConfigurationSection mySection = config.GetSection("applicationSettings");
config.SectionGroups.Clear();
config.Save(ConfigurationSaveMode.Full);
I've yet to see any sample code that performs this obvious function.