Question

Hi,

I have stored a couple of settings in my Settings.setting file(winform application) and I can see in the App.config that most of them is saved here under applicationSettings and userSettings.

There is however one applicationSetting that do not exists? I have also checked C:\Users[username]\AppData[ApplicationName] Local(windows7) but the setting is not there?

Could I add it manually to the app.config like this :

<applicationSettings>
    <MyApp.Client.Main.Properties.Settings>
      <setting name="MySetting" serializeAs="String">
        <value>C:\temp</value>
      </setting>
    </MyApp.Client.Main.Properties.Settings>
</applicationSettings>

Will this work?

Edit1:

This is how the Settings.Designer.cs looks like :

    [global::System.Configuration.ApplicationScopedSettingAttribute()]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Configuration.DefaultSettingValueAttribute("c:\\")]
    public string MySetting {
        get {
            return ((string)(this["MySetting"]));
        }
    }

This is my userSEttings part in app.config :

  <applicationSettings>
    <Orbit.Client.Main.Properties.Settings>
      <setting name="MySetting23" serializeAs="String">
        <value>False</value>
      </setting>
      <setting name="MySetting24" serializeAs="String">
        <value>False</value>
      </setting>
      <setting name="MySetting25" serializeAs="String">
        <value>False</value>
      </setting>
      <setting name="MySetting26" serializeAs="String">
        <value>False</value>
      </setting>
    </Orbit.Client.Main.Properties.Settings>
  </applicationSettings>
  <userSettings>
    <Orbit.Client.Main.Properties.Settings>
      <setting name="MySetting49" serializeAs="String">
        <value />
      </setting>
      <setting name="MySetting49" serializeAs="String">
        <value />
      </setting>
      <setting name="MySetting48" serializeAs="String">
        <value />
      </setting>
      <setting name="MySetting47" serializeAs="String">
        <value>False</value>
      </setting>
      <setting name="MySetting46" serializeAs="String">
        <value>False</value>
      </setting>
      <setting name="SkinName" serializeAs="String">
        <value>Blue</value>
      </setting>
    </Orbit.Client.Main.Properties.Settings>
  </userSettings>
Was it helpful?

Solution

Does it happen to be a connection string? These are not stored in the applicationSettings section. Otherwise, it is not possible to have application settings that are not stored in the ApplicationSettings section. Could be your app.config is out of sync. Recompile your project.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top