I have a list of assembly fully qualified names, and I check if some assembly is in the GAC where my app is running.
For example, I'm looking to do something like:
var result = AssemblyIsInGAC("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
I've tried using the fusion API (CreateAssemblyCache and QueryAssemblyInfo), as it is described in this blog post, but unfortunately it only works with partial names of assemblies
If I call QueryAssemblyInfo("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"), it gives me a FileNotFound exception if I call it QueryAssemblyInfo("mscorlib") it returns the latest version of mscorlib, which is not always the version I'm looking for.
Any ideas on how I can do this?
UPDATE: I cannot load the assembly into my app so cannot use Assembly.Load, Assembly.ReflectionOnlyLoad, etc.
You can use CreateAssemblyNameObject and CreateAssemblyEnum
For example =>
I get (I have put the full name, you can reduce it to filter with a string as a function parameter) :
with declarations =>