I am trying to update the app.config file of another application from my project both are in c#. I know how to update it for the project in memory but not sure how to access the app.config file of my other project. I have following code but that will change the app.config file of my current project not the other one ....thanks for the suggestions or ideas
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile);
foreach (XmlElement element in xmlDoc.DocumentElement)
{
if (element.Name.Equals("appSettings"))
{
foreach (XmlNode node in element.ChildNodes)
{
if (node.Attributes[0].Value.Equals("Setting1"))
{
node.Attributes[1].Value = "New Value";
}
}
}
}