I want to add/remove/upsert a line for ADO .NET data provider programmatically with C#.
My first thought was to parse the file with some parser (like Eto.Parse), then add/remove necessary span of text and then write a new file into install image directory (which is not write protected unlike to write protected main machine.config).
Then I think, that the file is xml, and it is possible to use existing xml machinery instead of custom parser. Load XML, build object model from XML, modify it and serialize.
Then I realise, that object model for working with configs is already present in System.Configuraion namespace.
And I decide to search an existing example on how to modify the machine config with these classes. I found only an example how to obtain it's location new ConfigurationFileMap().MachineConfigFilename;
(see The best way to get a path to machine.config of a different .NET version)