My only concern is if somehow an assembly that was suppose to be upgraded
doesn't get removed via the installation proces (or whatever) and the
user browses to find it and decides s/he wants to load it.
Basically, assume that the Contacts channel (say version 1.0.0 w/
diskname of contacts.dll) is in the \Channels directory. The user
decides to "load" that one. All is fine. Then later they install a new
version say (version 1.1.0) and the old version (1.0.0) does NOT get
removed. The filenames are the same (contacts.dll). Now the app is
"hosting" 2 Contacts I want to be sure that this does NOT happen.
Does this make sense? Also, yes, i'm speaking specifically about .net
assemblies.
If i listen for the AssemblyLoad event, how can i see if that assembly
(regardless of version) is loaded? If loaded, i really want to "unload"
it, but apparently that can't be done, but if i can at least stop loading
in the first place, i can at least work around that.
Doug
Stoitcho Goutsev (100) said:
Doug,
I assume you are talking .NET assemblies here. One .NET dll assembly can
be attached to a application domain only once. However assembly with the
same file name can be attached to the same domain more than once of its
full name (file name, version, culture and public key token) differ. In
this case it is considered to be different assembly. Unfortunately on
the disk they appear with same file name.
Assemblies with the same full name can be attached to a process more
than once if they are laoded in different AppDomains.
You shouid probably elaborate little bit on your question. What are your
worries exactly?
If you want to get notified when assembly gets loaded in the
applcication domain you can hook on the AppDomain.AssemblyLoad event.
--
Stoitcho Goutsev (100) [C# MVP]
Ok,
I think this is my last one - in my app, the user can select via a
dialog box the dll's they want to load. I use a checkbox to track this
(no worries there), but, once a dll has been bound, how can i make sure
that during the session that a dll can't be bound twice? I'm assuming
there's "protection" w/i the reflection process to stop this, (if so,
is there an exception that is thrown? ), if not, what can i do to stop
this from happening.
Doug