Using Application Settings and reading defaults from app.config

Posted by Peter Goras on Stack Overflow See other posts from Stack Overflow or by Peter Goras
Published on 2010-04-02T06:37:40Z Indexed on 2010/04/02 6:43 UTC
Read the original article Hit count: 298

Filed under:
|
|

Hi, I need to deploy a Windows Forms application using ClickOnce deployment. (VS2008, .NET 3.5) And I need to provide a configuration file for this app that any user can modify. For this reason, I am using Application Settings instead of standard appSetttings in app.config so I can separate the the user config from app config.

see http://msdn.microsoft.com/en-us/library/ms228995(VS.80).aspx

Creating a Settings.settings file using VS generated a class with hard-coded default values like this:

[global::System.Configuration.DefaultSettingValueAttribute("blahblah")]
public string MyProperty
...

WTF? I want to read the default values from the app.config!

So I created my own class deriving from ApplicationSettingsBase but I cannot get this to read values from the app.config. Any ideas?

© Stack Overflow or respective owner

Related posts about c#

Related posts about clickonce