none
How to check if assembly exists and get assembly info in Profiler? RRS feed

  • Question

  • Hi,

    I use IMetaDataAssemblyEmit::DefineAssemblyRef method to define my probe reference.

    If I set the parameter ASSEMBLYMETADATA's version is 1.0.0, but the probe in GAC is 1.1.0, the w3wp.exe crash.

    So I think I should verify the probe first.

    When PublicKey and szName is fixed, how to check whether the assembly exists or not, and get its information like version?


    Thursday, November 10, 2016 4:14 AM

Answers

All replies

  • Hi IMMark,

    >>"how to check whether the assembly exists or not, and get its information like version?"

    To get assembly information, you could use GAC Manager library. GAC Manager is an open source project that comes in two parts - a fully functional application to manage the Global Assembly Cache on your computer, and a C# API to allow you to manage the GAC yourself.

    You could download the library and sample code from following link.

    GAC Manager

    The sample code use Apex framework, so you need to install it from NuGet before launching this sample.

    After you get the assembly list, you could search it by PublicKey and szName.

    Best Regards,
    Li Wang


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Friday, November 11, 2016 7:01 AM
    Moderator
  • Hi, DoeNet Wang

    I'm sorry for not describing my question clearly.

    I know the tool to query assembly information, but I want to do that in my Profiler written in C++.

    The tool you given is written by C#.

    Or say, are there any C++ api to query assembly information as the tools above done?

    Thank you!

    Friday, November 11, 2016 8:01 AM
  • Hi IMMark,

    >>"are there any C++ api to query assembly information as the tools above done?"

    Here's the documentation for the undocumented GAC API which is designed to be used from native code(C++). 

    DOC: Global Assembly Cache (GAC) APIs Are Not Documented in the .NET Framework Software Development Kit (SDK) Documentation

    Best Regards,
    Li Wang


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Proposed as answer by Kristin Xie Wednesday, November 16, 2016 9:39 AM
    • Marked as answer by IMMark Tuesday, November 22, 2016 1:33 AM
    Friday, November 11, 2016 8:15 AM
    Moderator