Hi,
I have the following appSettings in my app.config file:
<appSettings>
<!-- Some comments here -->
<add key="MyKey1" value="1"/>
<!-- Some comments here -->
<add key="MyKey2" value="2"/>
</appSettings>
After issuing the Save method as shown below, all comments under my appSettings section are gone:
Dim fileMap As New Configuration.ExeConfigurationFileMap()
fileMap.ExeConfigFilename = "MyApp.exe.config"
Dim appConfig As Configuration.Configuration = Configuration.ConfigurationManager.OpenMappedExeCo nfiguration(fileMap, Configuration.ConfigurationUserLevel.None)
With appConfig.AppSettings
.Settings("MyKey1").Value = "10"
.Settings("MyKey2").Value = "20"
End With
appConfig.Save(Configuration.ConfigurationSaveMode .Minimal)
Any way to preserve my comments? Thanks!
--
Regards,
Antonio Ooi
"Everyone dies, not everyone really lives"