G
Guest
I've been trying to reflect across all assemblies in the running application
at Application_Start, but I've been having trouble developing a consistent
mechanism. I basically just need to look for all classes that derive from a
certain class, as well as classes that contain a custom attribute.
AppDomain.CurrentDomain.GetAssemblies() does not always return all of the
app's assemblies. Sometimes it only returns about half of the assemblies,
which is very frustrating.
Another route I've tried is manually loading all the assemblies in the app's
bin folder and reflecting through those. The problem with this approach is
that it leaves all those extra assemblies hanging out in memory, when all I
needed to do was reflect through them, not execute anything on them. The app
will be using shadow copies of all the assemblies from some temporary folder,
meaning duplicates will just be wasting memory. I've tried loading them into
a temporary app domain, but I get security errors trying to load the dll's
from the bin folder into the temp domain (for asp.net app).
Basically, I just need a "best practice" that is consistent and dependable
for reflecting through ALL assemblies that an application uses that will work
for both web and win apps.
Thanks,
Tim
at Application_Start, but I've been having trouble developing a consistent
mechanism. I basically just need to look for all classes that derive from a
certain class, as well as classes that contain a custom attribute.
AppDomain.CurrentDomain.GetAssemblies() does not always return all of the
app's assemblies. Sometimes it only returns about half of the assemblies,
which is very frustrating.
Another route I've tried is manually loading all the assemblies in the app's
bin folder and reflecting through those. The problem with this approach is
that it leaves all those extra assemblies hanging out in memory, when all I
needed to do was reflect through them, not execute anything on them. The app
will be using shadow copies of all the assemblies from some temporary folder,
meaning duplicates will just be wasting memory. I've tried loading them into
a temporary app domain, but I get security errors trying to load the dll's
from the bin folder into the temp domain (for asp.net app).
Basically, I just need a "best practice" that is consistent and dependable
for reflecting through ALL assemblies that an application uses that will work
for both web and win apps.
Thanks,
Tim