Home All Groups Group Topic Archive Search About

Assembly - Where did I come from?

Author
31 May 2006 11:04 AM
Phill W.
Within an Assembly added to the Global Assembly Cache,

System.Reflection.Assembly.GetExecuting.Location

returns the path to the shadow(?) copy buried under
C:\Windows\Assembly\Gac\...

Is there an [easy] way of finding out where the DLL was /before/ it was
added to the GAC?  (and prefereably /without/ resorting to using the
GetPrivateProfileString API call on the .ini file that resides within
the GAC!)

My goal is to use a configuration file that lives with my [shared] DLL
(*not* with each client Application, which will be /Legion/), so I need
to know whence the Dll was copied into the GAC, so as to find my file.

TIA,
    Phill  W.

Author
31 May 2006 3:50 PM
Mythran
Show quote Hide quote
"Phill W." <p-.-a-.-w-a-r-d@o-p-e-n-.-a-c-.-u-k> wrote in message
news:e5jt2u$6lj$1@yarrow.open.ac.uk...
> Within an Assembly added to the Global Assembly Cache,
>
> System.Reflection.Assembly.GetExecuting.Location
>
> returns the path to the shadow(?) copy buried under
> C:\Windows\Assembly\Gac\...
>
> Is there an [easy] way of finding out where the DLL was /before/ it was
> added to the GAC?  (and prefereably /without/ resorting to using the
> GetPrivateProfileString API call on the .ini file that resides within the
> GAC!)
>
> My goal is to use a configuration file that lives with my [shared] DLL
> (*not* with each client Application, which will be /Legion/), so I need to
> know whence the Dll was copied into the GAC, so as to find my file.
>
> TIA,
>    Phill  W.

Once the assembly is registered in the GAC, it gets copied into the
%windir%\Assembly\Gac\... folder.  This is the one that is referenced when
you reference a GAC assembly.  If you need to read a resource manifest from
the assembly, load the assembly that's in the GAC and call the
GetResourceManifestStream method on the Assembly object.  This will give you
a Stream that you can use to read the configuration file as long as you set
the file's Build Action property to Embedded Resource.

HTH :)  Oh, and this is just a way to do it, not what you requested.  I'm
not sure how to go about doing that.

Mythran