Can't delete an assembly from the GAC!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I need to delete an assembly from the GAC but it tells me

"Can not acces file 'IDODBLibNET' because it is being used by another process"

Now, I have deleted the assemblies that I know depend on this one. I can't
remember any other.

Is there a list of dependencies somewhere so that I can see which assembly
is depending on the one I need to delete?
 
How are you deleting it? I've had issues when doing it from Windows
Explorer, so I only do it from the command line now.

Derrick
 
Yes I am using the Windows Explorer. However I don't think its going to
change anything to do it in command line since I also tried deleting it
through the .NET Configuration 1.1.

Anyway, even if it could be done by cmd line, the other part of my question
still holds: how can we find out which other applications depend on one given
assembly?

--
Thanks in advance,

Juan Dent, M.Sc.


Derrick said:
How are you deleting it? I've had issues when doing it from Windows
Explorer, so I only do it from the command line now.

Derrick
 
Hi,

Did you try to examin the manifest of your assembly with ildasm.exe ?
All referenced assemblies are indicated in lines

".assembly extern ....REFERENCE ASSEMBLIES HERE...."

Nicolas Guinet
 
Looking at the manifest of the assembly I am not able to delete from the GAC
will not help. It will tell me its dependencies but not who else depends on
it.

No, there must be someway to find out when an assembly states that another
one uses it, to find out who it is referring to..

--
Thanks in advance,

Juan Dent, M.Sc.


Nicolas Guinet said:
Hi,

Did you try to examin the manifest of your assembly with ildasm.exe ?
All referenced assemblies are indicated in lines

".assembly extern ....REFERENCE ASSEMBLIES HERE...."

Nicolas Guinet
 
To list references:
gacutil /lr <assembly name>

To force removal from the GAC despite the references:
gacutil /uf <assembly name>

For more informtion on gacutil, see
http://msdn.microsoft.com/library/en-us/cptools/html/cpgrfGlobalAssemblyCacheUtilityGacutilexe.asp.



Juan Dent said:
Looking at the manifest of the assembly I am not able to delete from the
GAC
will not help. It will tell me its dependencies but not who else depends
on
it.

No, there must be someway to find out when an assembly states that another
one uses it, to find out who it is referring to..
 
"To list references:
gacutil /lr <assembly name>"

Does nothing but display the complete assemly name (public token, etc).

There must be a tool for what I want.
 
Hi

Because the DLL itself will not record who will load it, it may be used by
many processes.
I think you may try to use the tool below to find what DLL certain
processes have.
ListDlls
http://www.sysinternals.com/Utilities/ListDlls.html
Process Explorer(GUI)
http://www.sysinternals.com/Utilities/ProcessExplorer.html

e.g. Use Ctrl+E and input Dll name.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
The fact that you're seeing only the assembly name means that no
applications have registered their references to this GACed assembly using
the tools provided for this purpose. Given this, you will need to track
down the referencing assembly on your own. If the assembly is actually
running, the SysInternals ProcessExplorer tool that Peter mentioned should
help with this. However, it may also be that the DLL file is simply locked
as an open file rather than as executing code, so you might want to try
FileMon (http://www.sysinternals.com/Utilities/Filemon.html) if you can't
find a process that's running your assembly.
 
Hi and thanks. Just one question:

How does one register that a certain assembly depends on another? As in your
comment:
 
That's not the way that assemblies in the GAC work. There is no static piece
of data anywhere in the system that contains a list of all the assemblies
that contain references to an assembly in the GAC. A different mechanism for
tracking references was used.

Currently, each time an assembly is installed into the GAC an object called
an InstallReference is used to identify the entity that is installing the
assembly into the GAC. There are various options with this object but you
can think of it as a key that should be unique per entity that installs an
assembly into the GAC. Each unique key is added to the store associated with
the GAC'd assembly. These are the references that get listed...they are not
individual assembly references, they are installing entity references.

When the assembly is uninstalled the same key should be passed to the
uninstall routine, and the key is removed from the GAC. When all the keys
have been removed the assembly itself is removed from the GAC.

The problem you are experiencing is that you have a running application that
has opened up the assembly, and until you get that app or service to
terminate the operating system wont let you delete the file. Use the
SysInternals process explorer to search for who has that assembly loaded. It
may be a service (perhaps a SQL or web service?) that needs to be shutdown.

Many of these details are explained at this blog...
http://blogs.msdn.com/junfeng/archive/2004/09.aspx

Juan Dent said:
Looking at the manifest of the assembly I am not able to delete from the
GAC
will not help. It will tell me its dependencies but not who else depends
on
it.

No, there must be someway to find out when an assembly states that another
one uses it, to find out who it is referring to..
 
"gacutil /i /r" is the basic approach. VStudio setup projects also allow
you to specify registration like this via the properties of an assembly that
is to be installed in the GAC. (I'm guessing that a call out to gacutil
might be used in this case as well, but I've never cared enough to check
whether that's true or not...)
 
Back
Top