So if it doesn't know *which* one uses it, how does it know *whether* any
applications use it?
COM doesn't know this, for its components. You can do "regsvr32 any.dll
/u"
on a COM server that is used by dozens of essential applications installed
on
the machine, and as long as they're not using the COM object at that
particular moment in time, then it will quite happily unregister it and
you
will be able to delete it.
But just to test -
Create a GAC-able component, and without creating any applications that
depend on it, use gacutil.exe to put it into the GAC. Now, create another
GAC-able class library, and add a project that depends on it. Add a third
project as the setup project, and tell it to put the class library in the
GAC. Install it. Then go to the GAC and try to delete the two components.
It
will let you delete the first, but will tell you that 'Assembly ~~~~ could
not be deleted as it is required by other applications' for the second.
And I fail to believe that this is due to the reference count, as if you
right click on any component in the GAC and click properties, it will tell
you that its reference count is 1 - it is *always* 1, no matter whether,
or
how many, other applications are depending on it - it's never zero, and
never
more than 1.
It must have some way of knowing whether to put up a message box or not,
because it always makes that decision correctly.
Do you see what I mean, and how it's different to COM?
Nicholas Paldino said:
Bonj,
That would be hard to do, because applications don't have to register
themselves as needing to use particular components in the GAC. It's
analagous to trying to find out what applications use a particular COM
component. The best you could do is search all managed assemblies on the
machine, and see which one has a reference to the type in the GAC.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)
Bonj said:
When you view the GAC in windows explorer, it shows it as a special
type
of
view. It also tells you if you try to delete an assembly that is a
dependency
of an installed application, but if nothing is dependent on it, then it
will
delete OK. If it won't delete as it's needed by an application - is
there
any
way of finding out which one?