how to find if dll is installed in GAC

I have the path of some dlls like -

reference.Path

"C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50215\\System.Xml.dll"

reference.Path

"C:\\JaproTestPerforce\\JaproTestWorkspace\\MasterProject\\dev\\src\\_Ma

sterSub1Lib\\cs\\obj\\Debug\\MasterSub1Lib.dll"

Now I need to find if these dlls are installed in GAC!

Is there any .NET framework provided class to find this out? (NOT DURING RUNTIME!)

The only I an think of is to find if the file is in

"C:\\WINDOWS\\Microsoft.NET\\Framework\"..

Is there any better way of doing this?

Any Help would be appreciated.

[667 byte] By [Roopa] at [2007-12-16]
# 1
Hi Roopa,

Managed code only provides a property on the Assembly object called GlobalASsemblyCache which returns a true/false value at runtime. Since you want a solution which is not at runtime, you will need to use the COM API for GAC which is not documented within the .NET Framework.

There is a KB Article which gives some tips on this:
http://support.microsoft.com/Default.aspx?kbid=317540

Also, check out the following sample which demonstrates the use of the COM API:
http://www.msjogren.net/dotnet/eng/samples/dotnet_gactool.asp

Further in v2.0, the GAC architecture has changed to accomodate for 64-bit versions of the DLLs. Read some info on this here:
http://blogs.msdn.com/junfeng/archive/2004/08/11/212555.aspx
http://blogs.msdn.com/junfeng/archive/2004/09/12/228635.aspx
Regards,
Vikram

Vikram at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Base Class Library...

.NET Development

Site Classified