Enumerating Global Assemblies

J

Joy

Hi,

I am providing the users of my application with the ability to create
..Net scripts within the application. I want to enable them to select
the dlls and assemblies they will need to allow their scripts to run as
well. So I want to duplicate what Visual Studio does where it provides
a form with all the globally defined .net assemblies available for the
user to reference in their program.

I found where these global assemblies are located on my machine:
C:\WINDOWS\assembly

However, when I try to enumerate the assemblies with the following
code:

Dim d() As String =
System.IO.Directory.GetFiles("C:\WINDOWS\assembly")

it is not able to capture any of those global assemblies - maybe
because they are pointers to the actual dll locations rather than
physical files themselves.

Anyway, all I want is a way to dynamically determine what globally
defined assemblies a user may or may not have on their machine and
display them to the user.

Does anyone know how I could do this??

Thanks!

Joy
 
G

Guest

Unfortunately there is no simple way to do this via C#. The Global Assembly
Cache (GAC), the directory you're trying to enumerate, uses a "weird" file
structure that has also changed from version 1.1 to 2.0 of .NET. You nwould
normally use the methods provided in fusion.dll to access and manipulate the
GAC.

However, there is a very good fusion wrapper library available on the
CodeProject that would help you a lot. Check it out:
http://www.codeproject.com/csharp/GacApi.asp

Hope this helps!

Brian Delahunty
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top