• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1091
  • Last Modified:

C# code to check if specific assemblies are in the GAC

I need C# code that will allow me to do the following:

1. Check that a specified group of assemblies are in the GAC
2. Check that all of these assemblies have the same (user specified) public key token
3. Check that all of these assemblies have the same (user specified) version number
4. Check that none of these assemblies are installed in the GAC (based on version and public key token) -- this check will be done after an uninstaller is run

Please provide code. Thanks
  • 2
2 Solutions
Hello jrwalker2, not sure if this can be done on c# code directly, I have this option:

You can use Process.Start() method to call "GACUTIL /L > C:\SOMEFILE.TXT" then you open that text file and process its contents, every entry has this format:

System.Configuration, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL

Tell me if you need more info to do it.
I think both of our solutions resolve the problem. I suggest to not delete the question, can be helpful to others.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now