hi,
strange problem:
after caling the Save method all my <value> elements which previously were empty conatin a "\r\n". i changed my code in that way, that i just open and save the configuration file, but the values are still changed.
Can someone tell me why and how to avoid this?
System.Configuration.ExeConfigurationFileMap map = new System.Configuration.ExeConfigurationFileMap(); map.ExeConfigFilename = "app.config"; System.Configuration.Configuration config = System.Configuration.ConfigurationManager.OpenMappedExeConfiguration(map, System.Configuration.ConfigurationUserLevel.None); config.Save(ConfigurationSaveMode.Modified, true);
app.config before:<MyApp.Properties.Settings><setting name="Setting" serializeAs="String"><value></value></setting></MyApp.Properties.Settings> app.config after: <MyApp.Properties.Settings><setting name="Setting" serializeAs="String"><value></value></setting></MyApp.Properties.Settings>