How to tell which application(s) have a given asse

2019-06-26 04:53发布

问题:

When trying to remove a given assembly (log4net.dll in this case, but it should apply to any similar case) using gacutil.exe, the action fails due to the assembly being required by an application. However, I can't figure out how to tell which application(s) actually require it. Since the output seems to indicate that the requirement is logged in the MSI database / Windows Installer, it would seem like some util would be able to either list all the GAC assemblies registered in the MSI database (and I could just search for entries with log4net.dll) or allow me to specify a particular GAC'd assembly and it would list the dependencies (ideally with any related dependency chains if they exist :)

C:\ » gacutil /u log4net
Microsoft (R) .NET Global Assembly Cache Utility.  Version 4.0.30319.1
Copyright (c) Microsoft Corporation.  All rights reserved.


Assembly: log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL
Unable to uninstall: assembly is required by one or more applications
Pending references:
              SCHEME: <WINDOWS_INSTALLER>  ID: <MSI>  DESCRIPTION : <Windows Installer>
Number of assemblies uninstalled = 0
Number of failures = 0

Thanks!

回答1:

I never found anything good for this. What I did (that worked, but sucks) was to run procmon to see what gacutil was accessing and noticed it hit a key HKCR\Installer\Products\098D637EEF1AFF14586E779FE4C38C4D. When I looked under that key in regedit, it showed that the product was "Plantronics Spokes Software".

I went into appwiz.cpl and removed that app, then afterwards gacutil /l log4net showed that log4net wasn't in the GAC anymore.

I'd still love to find out a better answer, but I guess for now 'run procmon, filter to process=gacutil.exe and path under HKCR\Installer\Products' is at least better than nothing.