This returns exactly the same string as the code I have been using, and the
GlobalAssemblyCache property returns also whether the assembly was loaded
from the gac or not.
The only thing I need is this string: 'c:\myAssembly.dll.config', whether
the assembly came from the gac or not, if possible retrieved from the
executing assembly (no extra load).
Thanks,
Michel.
On Tue, 18 Feb 2003 06:27:30 +0200, natty <[EMAIL PROTECTED]> wrote:
>Public bool AssemblyInGac(string AssemName, out string AssPath)
>{
> bool bRV=false;
>
> System.Reflection.Assembly assem =
>System.Reflection.Assembly.LoadWithPartialName(%your_assembly_name%);
>
>
>If(System.RunTime.InterpoServices.RuntimeInviroment.FromGlobalAccessCa
>che(assem)
> {
> bRV = true;
> AssPath = assem.CodeBase;
> }
>}
>
>Natty Gur, CTO
>Dao2Com Ltd.
>28th Baruch Hirsch st. Bnei-Brak
>Israel , 51114
>
>Phone Numbers:
>Office: +972-(0)3-5786668
>Fax: +972-(0)3-5703475
>Mobile: +972-(0)58-888377
>Know the overall picture
>
>
>-----Original Message-----
>From: Moderated discussion of advanced .NET topics.
>[mailto:[EMAIL PROTECTED]] On Behalf Of Michel
>Liesmons
>Sent: Tuesday, February 18, 2003 1:35 AM
>To: [EMAIL PROTECTED]
>Subject: [ADVANCED-DOTNET] Original CodeBase from GAC assembly
>
>Hi,
>
>I've been using a ConfigFileReader class to suppport per dll .config
>files.
>As long as my assembly was not in the gac I could retrieve the file
>successfully using this call:
>Assembly.GetExecutingAssembly().CodeBase + ".config"
>e.g. c:\myAssembly.dll.config
>
>After putting myAssembly in the gac, the call returns:
>c:/winnt/assembly/gac/myAssembly/1.0.0.0__8a939a2ee7fc88b8/myAssembly.dl
>l
>
>How can I get at the original codebase, the one that is also shown in
>Properties/General/Codebase of the assembly in the Assembly Cache MMC
>snap-
>in ?
>
>Thanks,
>michel.