Read settings added manually to app.config after compile
<p>I developed a Windows service. It uses a MyService.exe.config file for configuration, that looks like this (simplified with just one setting, <code>Prop1</code>):</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
&lt;configuration&gt;
  &lt;configSections&gt;
    &lt;sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" &gt;
      &lt;section name="MyNamespace.MyService.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /&gt;
    &lt;/sectionGroup&gt;
  &lt;/configSections&gt;
  &lt;applicationSettings&gt;
    &lt;MyNamespace.MyService.Properties.Settings&gt;

      &lt;setting name="Prop1" serializeAs="String"&gt;
        &lt;value&gt;Foo&lt;/value&gt;
      &lt;/setting&gt;

    &lt;/MyNamespace.MyService.Properties.Settings&gt;
  &lt;/applicationSettings&gt;
&lt;/configuration&gt;
</code></pre>

<p>When I deploy to a customer production environment I need to add more settings manually on the config file, for instance <code>Prop2</code>:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
&lt;configuration&gt;
  &lt;configSections&gt;
    &lt;sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" &gt;
      &lt;section name="MyNamespace.MyService.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /&gt;
    &lt;/sectionGroup&gt;
  &lt;/configSections&gt;
  &lt;applicationSettings&gt;
    &lt;MyNamespace.MyService.Properties.Settings&gt;

      &lt;setting name="Prop1" serializeAs="String"&gt;
        &lt;value&gt;Foo&lt;/value&gt;
      &lt;/setting&gt;

      &lt;setting name="Prop2" serializeAs="String"&gt;
        &lt;value&gt;Bar&lt;/value&gt;
      &lt;/setting&gt;

    &lt;/MyNamespace.MyService.Properties.Settings&gt;
  &lt;/applicationSettings&gt;
&lt;/configuration&gt;
</code></pre>

<p>Now if I start the service this lines of code:</p>

<pre><code>log.Debug(Properties.Settings.Default["Prop1"].ToString());
log.Debug(Properties.Settings.Default["Prop2"].ToString());
</code></pre>

<p>produce following output:</p>

<pre><code>Foo
Impossibile trovare la proprietà di impostazione 'Prop2'.
   in System.Configuration.SettingsBase.GetPropertyValueByName(String propertyName)
   in System.Configuration.SettingsBase.get_Item(String propertyName)
   in System.Configuration.ApplicationSettingsBase.GetPropertyValue(String propertyName)
   in System.Configuration.ApplicationSettingsBase.get_Item(String propertyName)
   in ...
</code></pre>

<p>The error in Italian means "Cannot find settings property 'Prop2'".</p>

<p><strong>How can I read settings added to app.config after compile time?</strong></p>

<p>I'm wondering whether it is not possible to add new settings to app.config when the application is already deployed, because every setting must be compiled and made available statically in <code>Properties.Settings.Default</code>. So to achieve what I want <strong>should I use a settings file managed by me, like re-inventing the wheel?</strong></p>