[Mono-list] Specifying assemblies on mcs command line

Jonathan Pryor jonpryor@vt.edu
14 Jun 2002 20:56:58 -0400


I found the documentation that I referred to below.  For the main
description of how .NET locates assemblies, see (beware line wrapping):

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconhowruntimelocatesassemblies.asp

Location probing is described in;

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconstep4locatingassemblythroughcodebasesorprobing.asp

In short, it looks (in order) at:

	[application base]/[assembly name].dll
	[application base]/[assembly name]/[assembly name].dll
	[application base]/[culture]/[assembly name].dll
	[application base]/[culture]/[assembly name]/[assembly name].dll

The one downside with this approach is that I had actually
mis-remembered it.  I had thought that it looked for [assembly name]
first, not `[assembly name].dll'.  Oops.

The real question for any proposal is in how it's determined whether an
assembly name or a file name was provided.  It's entirely conceivable
that the assembly name may end in ".dll", resulting in a file name of
"assembly name.dll.dll".  (Weird, but it should work.)

I agree that it should be possible to specify either assembly names or
file names with `-r'.  I'm just wondering how you plan on doing that.

I suppose you could try `Assembly.Load' first, and if that fails try
`Assembly.LoadFrom', and if that fails signal an error...

More details would be welcome. :-)

Thanks,
 - Jon

On Fri, 2002-06-14 at 07:17, Jonathan Pryor wrote:
    Comments Inline.
    
    On Fri, 2002-06-14 at 06:46, Paolo Molaro wrote:
    <snip>
    
        My proposal is to change mcs to not add the dll extension if LoadFrom()
        fails (or at least to add it only if it's not there already). This way
        we could document better the behaviour of the -r and -L options.
        
    I disagree, slightly.  On .NET, I have noticed on occasion that a
    "Fusion Log" is printed to the console when I attempted to load an
    Assembly at runtime and it failed.  The fusion log usually lists both
    the name I passed to the Load/LoadFrom method, and my provided name with
    ".dll" appended.
    
    I believe that the .NET documentation lists (somewhere) the locations
    and names searched for when looking for Assemblies.  Alas, I'm not able
    to look up the documentation right now, but if you search for Assembly
    Loading (and related), you should find it.
    
    So, I think we need to search for *both* the assembly with the specified
    name, plus the assembly file with ".dll" appended.
    
        -r takes either an assembly name or a filename. If given an assembly
        name, the runtime tries to load the assembly from the runtime-specific
        search paths (default path + MONO_PATH with the mono runtime, dunno what
        the ms runtime uses). If given a filename, mcs tries to load the
        assembly in the current directory and in the directories specified with
        the -L option.
    
    IIRC, `csc' also behaves this way with its `/r' argument.
        
        How does that sound?
        
    Sounds good, but we should look up Assembly loading in the .NET
    documentation and try to stay compatible with what's documented.
    
        lupus
    
        -- 
        -----------------------------------------------------------------
        lupus@debian.org                                     debian/rules
        lupus@ximian.com                             Monkeys do it better
        
    
     - Jon
    
    
    
    _______________________________________________
    Mono-list maillist  -  Mono-list@ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list