Assembly - Where did I come from?

P

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

Mythran

Phill W. said:
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
 

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