[Mono-dev] AppSettings, embedding C

Gonzalo Paniagua Javier gonzalo at ximian.com
Wed Mar 22 14:58:19 EST 2006


On Wed, 2006-03-22 at 16:32 +0100, vavra at software602.cz wrote:
> Hello,
>  from C I call C# dll  with code:
> System.Configuration.ConfigurationSettings.AppSettings["GroupwareRoot"];
> 
> on Windows I have own config file tdav.exe.config (for executable
> tdav.exe):
> <configuration>
>         <appSettings>
>        <add key="GroupwareRoot" value="Groupware"/>
>        </> 
> </>
> 
> How I tell C# dll to load this tdav.config?
> I tried mono_config_parse("tdav.config") with/without fullpath, but no
> success ;-(

For Configuration.AppSettings ["blah"] to load its data from
tdav.config, it has to be executed from an assembly named 'tdav' which
is in the same directory as 'tdav.config'.

The concatenation of assembly->basedir + assembly->image->name +
".config" will give you the path to the file that C# will expect. So if
you have /tmp/tdav.exe, the configuration file loaded for
System.Configuration will be /tmp/tdav.exe.config.

-Gonzalo






More information about the Mono-devel-list mailing list