Groups | Blog | Home
all groups > dotnet clr > october 2005 >

dotnet clr : Loading Assembly without know its physical location.


orianavim NO[at]SPAM gmail.com
10/28/2005 2:54:52 PM
Hi,

I'm trying to create a map of my project reference while looping
through my dll references.

This is what I'm doing:

1. I'm able to load my root assembly using "Assembly.LoadFile"
2. get all the references AssemblyNames using
"assembly.GetReferencedAssemblies();"
3. Trying to load each one of those references: all the reference which
are in the GAC are loaded, and all the others (which are my other
project dll's) cannot be located. Is there anyway to load those
dll's without knowing their location?

My second question. If my project reference dll's without copy them
localy, how can I find their physical file? Any idea?

I already tried all the other function given in the Assembly class,
none of them worked.

I'm using VS 2005.

Thanks.
EP
11/22/2005 6:30:29 AM
Hello orianavim@gmail.com,

[quoted text, click to view]

When the framework needs an assembly, it will look for it in certain places
(GAC, download cache, app dir, etc.) If it's not in one of those places,
and you don't know where it is, it would be pretty hard to load.
You might be talking about finding it at runtime. You can load the assembly
by assemblystring, and attach to the AssemblyResolve event. When the framework
can't find an assembly, it will ask your callback to locate it.

[quoted text, click to view]

Select one of the references in VS and look at the properties window, the
"Path" property should show you the physical location.

[quoted text, click to view]

AddThis Social Bookmark Button