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
Who is Participating?
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.