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
LVL 1
jrwalker2Asked:
Who is Participating?
 
fmonroyCommented:
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=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL

Tell me if you need more info to do it.
0
 
slado2Commented:
0
 
fmonroyCommented:
I think both of our solutions resolve the problem. I suggest to not delete the question, can be helpful to others.
0
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.