Getting EXEName via DLL in .Net

  • Thread starter Thread starter Douglas Martin
  • Start date Start date
D

Douglas Martin

I'm not sure this is the correct News Group. My question
goes to the Framework class that will identify the name of
the executable running - my mainline EXE - from a Class
Library (dll).

About 80% of my programming is batch, unattended
execution, programs, which are now refered to a console
programs. Naturally, I try to have most housekeeping code
isolated in commonly shared code (in VB6 it was eithin in
DLLs or a mCommon.bas module included in each program).

I used to be able to use app.EXEName to get this
information. Documentation says this has been superceded
by
System.Reflection.Assembly.GetExecutingAssembly.Location
which returns the full path and filename, which I can just
parse to get the EXEName (filename portion only).

However, when I use this function from within a common
class library (which now has the same code reworked that
was in mCommon.bas), it returns the name of the class
library DLL and not the calling, mainline, EXE.

Is there a native framework method/property that exposes
this value?

regards,

doug
 
It didn't give me the executable name of the calling
assembly, instead it gave me the name of the higher level
class library (the collection of several classes of which
this common class is just one class in the mix).

MS supplies great documentatioin for the syntax of these
proprties and methods, but gets weak on examples. And I'm
not doing well just trying to drill down the objects in
debug to find the values which then point to the
methods/properties.

Course this can't be tested in high level module because
it is the high level module. I would expect the name to
be right.

I do miss that lazy "edit and continue" in VB6.....

doug
 
I must have been debugging from somewhere else. I retried
it, amoung a few other options that hinted strongly that I
should retry your suggestion and it did returnnthe
expected value - course you know that.

Thanks much.

Cheers to you! And my shout as well!

doug
 
Back
Top