Try

Assembly.GetExecutingAssembly().Location

Instead. According to msdn docs this is

~~
The location of the loaded file that contains the manifest. If the loaded
file was shadow-copied, the Location is that of the file before being
shadow-copied.
~~

Alternatively,

System.Reflection.Assembly.GetAssembly(typeof(whatever)).CodeBase;

Should work.

~ James Crowley

---------------------------------------------
WebZinc - turning the web into an Object
 >> http://www.webzinc.net/
---------------------------------------------
Programming tutorials, articles & source code
 >> http://www.developerfusion.com/
---------------------------------------------



-----Original Message-----
From: Moderated discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED]] On Behalf Of Michel Liesmons
Sent: 17 February 2003 23:35
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.dll

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.
-


-

Reply via email to