[Mono-dev] Problem with Configuration Manager

Petit Eric surfzoid at gmail.com
Tue Oct 30 14:42:39 EDT 2007


first try to replace :
Console.WriteLine("There is not configuration file :(.");
by
Console.WriteLine("There is not configuration file :(.") +
Environment.NewLine + Environment.stackstarce;

After image the progrmme is "MyProg.exe" and with mkbundle cmd yu say
output is MyBdlProg.exe, so it continu to shearch MyProg.exe.config or
MyBdlProg.exe.config ?
is mono ./prog.exe give the good result ?
It should be help full to give more info, like the output of shell commands :
uname -a
mono -V
monodevelop --version
.....

2007/10/30, Torello Querci <tquerci at gmail.com>:
> Hi to all.
>
> I need to get a boundled application with mono on the 2.0 environment.
> Making some test with this environment I noted that the
> ConfigurationManager seems not work in the boundled application.
>
> I make some test using
>
> mkbuild2 --deps --static -o app.exe MyApp.exe
>
> and
>
> mkbuild2 --deps --static -o app.exe MyApp.exe -f MyApp.exe.config
> With both the command my application not read the configuration parameter.
>
> Down I put the sample code that I use.
>
> It's a bug or not? For me is not a problem using a xml reader but I
> need do know to not make the same work two times ....
>
>
> P.S. Sorry for my english.
>
>
> Best Regard, Torello Querci
>
> ---------------------------------------------------------------------------
> using System;
> using System.Configuration;
>
> namespace ConfigurationBug
> {
>         class MainClass
>         {
>                 public static void Main(string[] args)
>                 {
>                         System.Collections.Specialized.NameValueCollection
> apps=System.Configuration.ConfigurationManager.AppSettings;
>
>                         if (apps != null) {
>                                 Console.WriteLine("The configuration file is found.");
>                                 object obj=apps["application_key"];
>                                 if (obj!=null) {
>                                         Console.WriteLine("The configuration key \"application_key\" has
> the value: "+obj.ToString());
>                                 } else {
>                                         Console.WriteLine("The configuration key \"application_key\" is
> missing :(.");
>                                 }
>                         } else {
>                                 Console.WriteLine("There is not configuration file :(.");
>                         }
>                 }
>         }
> }
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>



More information about the Mono-devel-list mailing list