You can always override the codebase of an AppDomain you're creating to be
the location of the plugin DLL.

You can also use ReflectionOnlyLoad if you pass an AssemblyName object,
which can be retrieved via AssemblyName.GetAssemblyName( string assemblyPath
) which sets the codebase for your loaded assembly so fusion will search
there for dependencies (I thought LoadFrom did that also).

On the other hand, if there are dependencies missing, and any Type in the
assembly your loading requires that dependency for its function (return
values of functions, property return values, etc) then Assembly.GetTypes()
will fail anyway with a TypeLoadException (or FileNotFoundException or
somesuch).

Adam..

-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of Graeme Taylor
Sent: Thursday, November 08, 2007 10:03 AM
To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
Subject: [ADVANCED-DOTNET] Reflection: Get list of types without loading
assembly

Hi,

I would like to get a list of public types that are in an assembly.  The
complicating factor is that I do not wish to load the assembly into my
AppDomain as I will never execute it.

I cannot use Assembly.ReflectionOnlyLoadFrom(...) as the dependencies will
not be available.

I thought about loading the assembly into a seperate appdomain which I can
then unload however, the assembly will not be in the search path of the
AppDomain.

Reason for this is I have a system with aplugin architecture.  I'm
building a UI for support staff where the can push a new plugin (assembly)
onto the production system.  As part of this, the UI should read the types
from the assembly so that the support staff can enter into the database
config items required for each type.

Hope this makes sense! Any help appreciated!

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to