Retrieving GAC Assemblies and Information
Follow these steps to get information such as:-
- Assembly Name
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
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.
References: Retrieving GAC Assemblies and Information from our NCG partner Punit Ganshani at the Punit Ganshani blog.