Finding the Version of a COM Library File Using ASP.NET

I have a software diagnostics page where I would like to list the version information of a file from several COM DLLs. The page runs under a regular, limited ASP.Net account (NETWORK SERVICE).

Given the ProgIDs of the COM library, what's the best way to get the path to the physical file or otherwise access the file version #?

Note that loading it with Type.GetTypeFromProgID and using the Assembly object will not work because the returned Assembly is the only one for mscorlib.

The installation path is user-selectable and is not guaranteed to be a specific value.

0


source to share


1 answer


One way to approach this is to use the COM CLSIDFromProgID function (Pinvoke.Net shows how to call this from .Net here ) to get the CLSID, use GUID.ToString ("B") to convert the CLSID to a formatted string and then use its to the registry to find where the COM server is registered.

The path will be HKEY_CLASSES_ROOT\CLSID\<YourCLSID>\InprocServer32

if the COM server is an in-process server (i.e. a DLL as you expect)



Note that the path to the file in the registry is not necessarily the full path.

+1


source







All Articles