How to Remove / Delete .NET assemblies from GAC (Global Assembly Cache)
As most of us know GAC (Global Assembly Cache) is the location where Windows saves all the .NET binaries or .NET assemblies. The physical location of GAC is %windir%\assembly (generally C:\Windows\assembly).Software installers can easily install and register these binaries to GAC using Windows Installer/MSI technology and on uninstalltion should remove them properly. But in some rare cases the installers won’t remove the binaries from GAC which can cause problems with other applications or newer versions of the same application.
So how can we forcefully remove these binaries from GAC? The answer is a small utility from Microsoft called Global Assembly Cache Tool (Gacutil.exe). This command-line utility was shipped with .NET 1.1 and is still available with the .NET SDK. But if you have any difficulty in finding it, then it downloaded from here: Download Gacutil.exe
Usage – Remove/Delete .NET binaries from GAC using gacutil.exe
A detailed description of the commandline switches of gacutil.exe is available in the above linked MSDN article. The relevant switches here are:
/silent - Suppresses the display of all output.
/u assemblyName – Uninstalls an assembly from the global assembly cache.
/uf assemblyName – Forces a specified assembly to uninstall by removing all references to the assembly.
/ul assemblyListFile – Uninstalls one or more assemblies specified in assemblyListFile from the global assembly cache.
For removing a single binary named Borland.Data.Common the following command can be used:
[path]\gacutil.exe /u Borland.Data.Common
For removing a list of binaries:
[path]\gacutil.exe /u \list.txt
where the list.txt file is a text file with the binary names listed one per line.
Other methods
There is an alternate ‘dirty’ way of achieving this. Uninstall all the .NET frameworks installed in your computer and reboot Windows. Now the folder %windir%\assembly (generally C:\Windows\assembly) is just like any other normal Windows folder. The rouge binaries can be manually deleted from the folder.









1 Comment
informative content