[Mono-dev] Problem with Configuration Manager
Torello Querci
tquerci at gmail.com
Tue Oct 30 12:19:43 EDT 2007
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 :(.");
}
}
}
}
More information about the Mono-devel-list
mailing list