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

Posted on 2007-09-29
Last Modified: 2012-05-05
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
Question by:jrwalker2
    LVL 5

    Accepted Solution

    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.
    LVL 8

    Assisted Solution

    LVL 5

    Expert Comment

    I think both of our solutions resolve the problem. I suggest to not delete the question, can be helpful to others.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Bit flags and bit flag manipulation is perhaps one of the most underrated strategies in programming, likely because most programmers developing in high-level languages rely too much on the high-level features, and forget about the low-level ones. Th…
    Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now