[MonoDevelop] Accessing configuration files

Oskar Berggren oskar.berggren at gmail.com
Mon Oct 11 03:20:54 EDT 2010


The app.config should be listed as a file in the project tree,
directly inside the project node. This will enable the build system to
properly copy the file in to the output folder, with the proper output
name.

/Oskar


2010/10/11 Ahmed Abdeen Hamed <ahmed.elmasri at gmail.com>:
> I managed to include the System.Configuration.dll and I compiled file.
> However, I am unable to read from my App.config file. Should I
> register the config file somewhere in the project so it can be
> accessible?
> Ahmed
>
> On Sun, Oct 10, 2010 at 4:09 PM, Ahmed Abdeen Hamed
> <ahmed.elmasri at gmail.com> wrote:
>> Hi Alan,
>> I didn't explicitly reference the System.Configuration.dll. How do I do that?
>> Thanks!
>> Ahmed
>>
>> On Sun, Oct 10, 2010 at 3:14 PM, Alan <alan.mcgovern at gmail.com> wrote:
>>> I assume you have a "using System.Configuration;' in your .cs file and
>>> you also reference System.Configuration.dll when compiling your app?
>>>
>>> Alan.
>>>
>>> On Sun, Oct 10, 2010 at 7:55 PM, Ahmed Abdeen Hamed
>>> <ahmed.elmasri at gmail.com> wrote:
>>>> My apologies for the second email but the correct syntax for the first
>>>> line is this:
>>>> NameValueCollection appSettings = ConfigurationManager.AppSettings
>>>>
>>>> Here is the error:
>>>> /Users/aabdeen/Projects/console-project/console-project/Main.cs(51,51):
>>>> Error CS0103: The name `ConfigurationManager' does not exist in the
>>>> current context (CS0103) (console-project)
>>>>
>>>> On Sun, Oct 10, 2010 at 2:44 PM, Ahmed Abdeen Hamed
>>>> <ahmed.elmasri at gmail.com> wrote:
>>>>> Hello,
>>>>> I am unable to access the solution configuration file using the C#
>>>>> code. For some reason it can't find the classes from the
>>>>> System.Configuration reference even though it has been imported via
>>>>> using statement. Here is the code snippet:
>>>>>
>>>>>
>>>>>                NameValueCollection appSettings = Configuration.AppSettings;
>>>>>
>>>>>                for (int i = 0; i < appSettings.Count; i++)
>>>>>                {
>>>>>                    Console.WriteLine("Key : {0} Value: {1}",
>>>>>                      appSettings.GetKey(i), appSettings[i]);
>>>>>                }
>>>>>
>>>>> Here is the error message:
>>>>> /Users/aabdeen/Projects/console-project/console-project/Main.cs(51,51):
>>>>> Error CS0103: The name `Configuration' does not exist in the current
>>>>> context (CS0103) (console-project)
>>>>>
>>>>> Any clue?
>>>>> Thanks,
>>>>> Ahmed
>>>>>
>>>> _______________________________________________
>>>> Monodevelop-list mailing list
>>>> Monodevelop-list at lists.ximian.com
>>>> http://lists.ximian.com/mailman/listinfo/monodevelop-list
>>>>
>>>
>>
> _______________________________________________
> Monodevelop-list mailing list
> Monodevelop-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monodevelop-list
>


More information about the Monodevelop-list mailing list