get current EXE file name?

  • Thread starter Thread starter Reginald Blue
  • Start date Start date
R

Reginald Blue

stupid question:

RemotingConfiguration.Configure("MyProject.exe.config");

(where the actual EXE that's built is named "MyProject.exe", of course).

is there any way to do that without hard coding it?

I tried:

RemotingConfiguration.Configure(null);

but then it doesn't read the config file at all.

I'm hoping for something like:

RemotingConfiguration.Configure(GetProjectEXEName() + ".config");

Except I can't find anything in the docs to say how to do that. I'm sure
it's in there somewhere...

--
Reginald Blue
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my
telephone."
- Bjarne Stroustrup (originator of C++) [quoted at the 2003 International
Conference on Intelligent User Interfaces]
 
Check in the System.Reflection.Assembly namespace. There are some static (I
think) methods in there that allow you to obtain the name of the current
assembly and/or manifest etc. There should be at least one function that
does what you need.



Reginald Blue said:
stupid question:

RemotingConfiguration.Configure("MyProject.exe.config");

(where the actual EXE that's built is named "MyProject.exe", of course).

is there any way to do that without hard coding it?

I tried:

RemotingConfiguration.Configure(null);

but then it doesn't read the config file at all.

I'm hoping for something like:

RemotingConfiguration.Configure(GetProjectEXEName() + ".config");

Except I can't find anything in the docs to say how to do that. I'm sure
it's in there somewhere...

--
Reginald Blue
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my
telephone."
- Bjarne Stroustrup (originator of C++) [quoted at the 2003 International
Conference on Intelligent User Interfaces]
 
AppDomain .CurrentDomain .FriendlyName

will give you the application name

however, to read the configuration file use

ConfigurationSettings .AppSettings

- Sarosh
-----Original Message-----
stupid question:

RemotingConfiguration.Configure("MyProject.exe.config");

(where the actual EXE that's built is
named "MyProject.exe", of course).
is there any way to do that without hard coding it?

I tried:

RemotingConfiguration.Configure(null);

but then it doesn't read the config file at all.

I'm hoping for something like:

RemotingConfiguration.Configure(GetProjectEXEName() + ".config");

Except I can't find anything in the docs to say how to do that. I'm sure
it's in there somewhere...

--
Reginald Blue
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my
telephone."
- Bjarne Stroustrup (originator of C++) [quoted at the 2003 International
Conference on Intelligent User Interfaces]


.
 
AppDomain .CurrentDomain .FriendlyName

will give you the application name

Yes, that's what I wanted.
however, to read the configuration file use

ConfigurationSettings .AppSettings

Unfortunately, that doesn't give me anything useful for the remoting
configuration. RemotingConfiguration.Configure only expects a file name.
Why it doesn't work like ConfigurationSettings is beyond me.
named "MyProject.exe", of course).

--
Reginald Blue
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my
telephone."
- Bjarne Stroustrup (originator of C++) [quoted at the 2003
International Conference on Intelligent User Interfaces]
 
Back
Top