[Mono-list] About System.Configuration.ConfigurationSettings.GetConfig() method

Jonathan Pryor jonpryor@vt.edu
13 Jun 2002 23:14:58 -0400


A better solution would probably be to use the
System.Reflection.Assembly methods...if the Assembly class were
implemented.  (Last I knew it wasn't fully implemented, but things
change...)

In particular, 

	Assembly.GetEntryAssembly().Location

will return the full path + filename of the program that started
execution for this AppDomain.  I'm not sure what it would do in a
multi-AppDomain environment, though.

Unfortunately, Assembly.GetEntryAssembly() isn't present in the ECMA
standard; it's part of .NET.

The advantage to using Assembly is that you don't need to worry about
parsing the command line arguments.  Additionally the ECMA standard
specifies that the first argument, if available, need not include path
information.

Since the application .config file is in the same directory as the
program, I think it's a reasonable assumption to state that you need the
program's path as well as its file name...

 - Jon 

On Thu, 2002-06-13 at 22:54, Girish Bharadwaj wrote:
    Hi, 
    
    According to LAMEDOC comment in this function, getting the name of the
    exe seems to be problematic.  From what I tested, you can probably use
    Environment.GetCommandLineArgs() to determine the executable's name. I
    did try with a simple dll + exe combination to get the command line
    args and it seemed to work. I think it would work in code as well.
    
    I can make the changes but since its my first entry into this I am not
    sure how to go about doing it. If someone else wants to make the mods,
    they can do that as well.
    
    Thank you,
    Girish Bharadwaj
    
    BTW: there is a bug in linking with references to a library. I dont
    know if it has been entered yet. I will search and enter if not found.
    
    
    
    _______________________________________________
    Mono-list maillist  -  Mono-list@ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list