GAC Information

  • Thread starter Thread starter John Lee
  • Start date Start date
J

John Lee

Hi,

Can anyone help me how to programatically get the information that is shown
as codebase when you use the Windows explorer to browse Windows\Assembly
folder -right click on any GACed assembly - properties - then you see the
codebase which is original location of the assembly.

How can I get that path in C# code? Thanks very much!

John
 
A right-click on an assembly in the Windows Explorer view of
\Windows\assembly shows a box with two tabs, General and Version, and
neither on my XP box show a codebase. In any case, the Explorer shell
extension view of that folder shows the files that are actually in that
folder, they are not somewhere else. Browse it with a command prompt and
you'll see the structure that the shell extension decodes in Explorer. It's
not clear to me what you're trying to do.
 
Hi, Phil,

Try to right click "System.Messaging 1.0.5000.0" and the codebase should be
file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/System.Messaging.dll
or try to use GACUTIL to gac one of your own strong named dll and then right
click that assembly there you should be able to see the codebase.

My question is how/where does the shfusion gets that information? It must be
stored somewhere because when you GAC an assembly using gacutil you passed
the assembly path and that path will be shown as codebase. How can I
programatically get it? - GAC viewer can get that info so it should be
available somewhere.

Or anyone know a better solution for my real problem: I have a dll that will
be invoked by BizTalk Server and so I do not control the entry point. This
dll have a configuration setting file located at the same folder as the
assembly, I GACed this assembly (this is required if it will be invoked by
BizTalk Server), inside this assembly, I was trying to use
System.Reflection.Assembly.GetExecutingAssembly().Codebase to get the
original path of my assembly before it's GACed - BUT it returns the path
like "c:\windows\assembly\gac\xxxxx" which is the location of the GACed
assembly. Is there a way to find out where is the GACed assembly come
from? - Then I realized that the GAC viewer actually can get that
information - it means that it's stored somewhere just matter of how to get
it out by using what API.

I tried some wrapper of fusion.dll - but w/o any luck to get that piece of
information. There must be a master that know how to get it :) Please
help!!!

Thanks!
John

Phil Wilson said:
A right-click on an assembly in the Windows Explorer view of
\Windows\assembly shows a box with two tabs, General and Version, and
neither on my XP box show a codebase. In any case, the Explorer shell
extension view of that folder shows the files that are actually in that
folder, they are not somewhere else. Browse it with a command prompt and
you'll see the structure that the shell extension decodes in Explorer. It's
not clear to me what you're trying to do.
--
Phil Wilson
[MVP Windows Installer]
Definitive Guide to Windows Installer
http://apress.com/book/bookDisplay.html?bID=280

John Lee said:
Hi,

Can anyone help me how to programatically get the information that is
shown as codebase when you use the Windows explorer to browse
Windows\Assembly folder -right click on any GACed assembly - properties -
then you see the codebase which is original location of the assembly.

How can I get that path in C# code? Thanks very much!

John
 
If you look in the same physical directory as the assembly (c:\windows\assembly\GAC\xxxx) there you will see a file called __assemblyinfo__.ini. If you take a look in this file (its in ini file format unsurprisingly) you will see a URL value which is the directory from which the assembly was GAC'd

(I'll have a think about the Biztalk side of things)

Regards

Richard Blewett - DevelopMentor
http://staff.develop.com/richardb/weblog

nntp://news.microsoft.com/microsoft.public.dotnet.languages.csharp/<[email protected]>

Hi, Phil,

Try to right click "System.Messaging 1.0.5000.0" and the codebase should be
file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/System.Messaging.dll
or try to use GACUTIL to gac one of your own strong named dll and then right
click that assembly there you should be able to see the codebase.

My question is how/where does the shfusion gets that information? It must be
stored somewhere because when you GAC an assembly using gacutil you passed
the assembly path and that path will be shown as codebase. How can I
programatically get it? - GAC viewer can get that info so it should be
available somewhere.
 
Back
Top