[Mono-dev] mkbundle + app.config

Alex Shulgin alexander.shulgin at yessoftware.com
Mon Sep 14 11:55:11 EDT 2009


There is a problem when using mkbundle together with 
System.ConfigurationManager: namely, app.config file is not loaded and 
you get empty configuration values, e.g. from AppSettings.

This has been reported before[1], but no one seems to get it fixed.

I've traced the problem down to mono_image_open_from_data_full() in 
mono/metadata/image.c which gives newly loaded images a unique names 
like this: data-0x012345678

Later, then ConfigurationManager is trying to load .config file for the 
assembly, it uses the fake name and naturally doesn't see a file named 
data-xxx.config near the bundled assembly.

I don't think it's possible to make use of bundled assemblies 
information buried in mono internals (mono/metadata/assebmbly.c).

So the other way round which worked for me is passing the bundled 
assembly name along with data to mono_image_open_from_data_full() to use 
instead of fake one (and after placing a copy of app.config already 
bundled in the binary).

Drawbacks?  Comments?


[1] http://go-mono.com/forums/#nabble-td20406123|a21214922

More information about the Mono-devel-list mailing list