Retrieving GAC Assemblies and Information

Retrieving GAC assemblies and their information. This was a question posed by one of my colleagues while he was developing a product. Now the answer to this is little tweaky.


Follow these steps to get information such as:-

  1. Assembly Name
  2. Version
  3. PublicKeyToken

I prefer not to use Reflection for this purpose and solving by a simple File Iteration method.

Iterate through directories in GAC
Now this GAC folder within Assembly is not visible in Windows Explorer, but you can see this on your

Command Prompt.
Iterate through Files in each directory in GAC
Files = System.IO.Directory.GetFiles(currentDirectory, “*.dll”);

This will give you the Assembly Name.
Iterate through the directories in this folder

For example, C:WindowsassemblyGACADODB has only one folder: 7.0.3300.0__b03f5f7f11d50a3a
Split this by ‘_’ to get two parts. Part-I represents the version of the assembly and Part-II represents PublicKeyToken

This is faster than using reflection and is easy to develop as well.

Happy development!

References: Retrieving GAC Assemblies and Information from our NCG partner Punit Ganshani at the Punit Ganshani blog.

Related Articles

Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments
Back to top button