views:

84

answers:

1

I have added some settings to my c# application using the configuration editor. There are three configuration items; two of type string and one of type int. All three have Application scope.

When I compile my application the exe.config file contains two subsections under <applicationSettings>. These are <appName.Settings> containing all three configuration items and <appName.Settings1> containing only the string values.

So, instead of having the following structure


<applicationSettings>
   <appName.Settings>
      ...
      ...
      ...
   </appName.Settings>
</applicationSettings>

I have the following structure


<applicationSettings>
    <appName.Settings>
        ...
        ...
        ...
    </appName.Settings>
    <appName.Settings1>
        ...
        ...
    </appName.Settings1>
</applicationSettings>

I have looked at the properties and cannot see anything that looks like it could prompt this behaviour. Can anyone shed any light on why this is happening and tell me how to stop it?

Thanks.

A: 

Look near the top of the config file for:

<sectionGroup name="applicationSettings" ...
    <section name="Settings" ...
    <section name="Settings1" ...
</sectionGroup>

Delete the Settings1 entry, then delete the applicationSettings section for Settings1 that you mention above.

<appName.Settings1>
        ...
        ...
</appName.Settings1>

By chance did you change the name of this application or assembly after creating the 2 string settings? When the assembly name changes it creates a new applicationSettings entry, AND leaves the old assembly name settings in the config file.

Jim
I don't recall changing the name and the configuration bears this out. My app is called SimpleURLChecker and the two entries in the sectionGroup are: <section name="SimpleURLChecker.Settings"... and <section name="SimpleURLChecker.Settings1"... I followed your advice, editing the app.config file, and that has done the trick. Thanks.
Pandelon