By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,673 Members | 1,268 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,673 IT Pros & Developers. It's quick & easy.

How do I determine the exe filename at runtime?

P: n/a
nfr
I have a Singleton Model object that can be instantiated by different
applications at runtime. This object activates a Channel using the config
file in its constructor, which needs the name of the config file as a
string.

Because the object does not know the application in which it is being
instantiated and because it's constructor is private, I need to know how to
determine the name of the default config file (i.e., filename.exe.config).

Does anyone know how I might do this?
Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
nfr
> Have you tried:

using System.Reflection;

...

System.Reflection.Assembly.GetCallingAssembly().Co deBase + ".config"


I looked into using Reflection but didn't see this one for some reason.
Thanks, that's exactly what I was looking for.
Nov 13 '05 #2

P: n/a
nfr
I take that back, it found the DLL it lives in but the the name of the .EXE
file that I am looking for.

"nfr" <nf*@nospam.com> wrote in message
news:uc**************@TK2MSFTNGP12.phx.gbl...
Have you tried:

using System.Reflection;

...

System.Reflection.Assembly.GetCallingAssembly().Co deBase + ".config"


I looked into using Reflection but didn't see this one for some reason.
Thanks, that's exactly what I was looking for.

Nov 13 '05 #3

P: n/a
nfr
Here's the problem. I have a DLL that ultimately lives withn an EXE of some
sort. I would like for that object to be able to discover the name of the
EXE in which it lives.

"nfr" <nf*@nospam.com> wrote in message
news:O6**************@tk2msftngp13.phx.gbl...
I take that back, it found the DLL it lives in but the the name of the ..EXE file that I am looking for.

"nfr" <nf*@nospam.com> wrote in message
news:uc**************@TK2MSFTNGP12.phx.gbl...
Have you tried:

using System.Reflection;

...

System.Reflection.Assembly.GetCallingAssembly().Co deBase + ".config"


I looked into using Reflection but didn't see this one for some reason.
Thanks, that's exactly what I was looking for.


Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.