Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Yes, there is a way to programmatically check whether a DLL exists in the GAC and display it in a grid.

First, you need to refer the System.EnterpriseServices.Internal namespace in your code. Then, you can use the AppsInterop class to check whether the DLL exists in the GAC by passing the DLL name as an argument to the IsInGac method.

If the method returns true, you can get the DLL details using the GetClassInfo method of the same class. You can then display the DLL details in a grid or any other UI component.

Here is some sample code to demonstrate this:

using System.EnterpriseServices.Internal;

// ...

string dllName = "MyAssembly.dll";  // Change this to the name of your DLL

if (AppsInterop.IsInGac(dllName))
{
    var classInfo = AppsInterop.GetClassInfo(dllName);

    // Display the class info in a grid or any other UI component
    // classInfo.Name contains the name of the class
    // classInfo.Version contains the version number of the assembly
    // classInfo.AssemblyName contains the full name of the assembly
}
else
{
    // Display a message indicating that the DLL is not found in the GAC
}