I am using ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
to open a configuration file, and then eventually calling Save()
on that config to update the config. The saving portion is working fine, but the resulting format is different than what the input was.
Is there a way to keep the formatting the same when calling Configuration.Save()
?
In the code below, I essentialy want the "After" block to look like the "Before" block after I call Save()
and update the value I need.
Before
<items>
<item domainName="DEV" url="http:/server1:8080" certificatePath="./cert1.cert" password="abc"/>
<item domainName="QA" url="http://server2:8080" certificatePath="./cert2.cert" password="123"/>
<item domainName="PROD" url="http://server3:8080" certificatePath="./cert3.cert" password="frt"/>
</items>
After
<items>
<item domainName="DEV" url="http:/server1:8080"
certificatePath="./cert1.cert" password="abc"/>
<item domainName="QA" url="http://server2:8080"
certificatePath="./cert2.cert" password="123"/>
<item domainName="PROD" url="http://server3:8080"
certificatePath="./cert3.cert" password="UpdatedProperty"/>
</items>