[Mono-list] Problem retrieving application settings using ApplicationSettingsBase
Daniel Lo Nigro
lists at dan.cx
Sun Jan 6 09:53:23 UTC 2013
For what it's worth, I've never used ApplicationSettingsBase but I'm using
a custom ConfigurationSection with an ASP.NET site and that's working fine
for me under Mono 3.0.2. I'm not sure if ConfigurationSection is something
specific to ASP.NET or whether it can be used in desktop apps as well.
Here's mine as an example:
This blog post has some more information on this:
On Sun, Jan 6, 2013 at 6:56 PM, greyseal96 <greyseal96 at gmail.com> wrote:
> First things first, I'm using MonoDevelop 18.104.22.168 targeting Mono 2.10.5.
> development machine is running Fedora 16.
> I'm trying to get a class derived from ApplicationSettingsBase to correctly
> retrieve the application settings stored in an app.config file. I have
> this before in .NET a few times so I'm pretty sure that I'm familiar with
> how it works and how to set up the app.config file. Having said that,
> though, it's always possible that I've missed something or messed something
> up. :)
> I'm trying to access a couple of properties which are marked with the
> [ApplicationScopedSetting()] attribute but the values aren't being
> from the app.config file. I don't have a default value set on these
> properties either so when I try to retrieve the values from the settings
> file, the properties (they are string type) are null. I have a couple
> properties in my class which are marked with the [UserScopedSetting()]
> attribute and I am able to save and retrieve these settings without any
> problems; it's only the application settings that aren't working for me.
> I have been looking all over and googleing to try to figure out why this
> might not be working but I haven't been able to find anything. Is this
> working in Mono 2.10.5?
> For reference, here is a copy of my app.config file:
> <?xml version="1.0" encoding="utf-8"?>
> <sectionGroup name="applicationSettings"
> type="System.Configuration.ApplicationSettingsGroup, System,
> Version=22.214.171.124, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
> <section name="mySettings"
> type="System.Configuration.ClientSettingsSection, System, Version=126.96.36.199,
> Culture= neutral, PublicKeyToken=b77a5c561934e089" />
> <setting name="AcctID" serializeAs="String">
> <setting name="AccKey" serializeAs="String">
> <add key="StringSetting1" value="some value"/>
> <add key="StringSetting2" value="some other value"/>
> Here's some of the code for my settings class:
> public class myAppSettings : ApplicationSettingsBase
> public string AcctID
> return (String)this["AcctID"];
> public string AccKey
> return (String)this["AWSAccKey"];
> //This is working fine; its setting is saved and retrieved
> correctly from
> the user.config file.
> public string TestSaveString
> return (String)this["TestSaveString"];
> this["TestSaveString"] = value;
> Any help in understanding how this works in Mono would be greatly
> appreciated. Thanks for any help that you can give.
> View this message in context:
> Sent from the Mono - General mailing list archive at Nabble.com.
> Mono-list maillist - Mono-list at lists.ximian.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Mono-list