get current EXE file name?

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

Mark Sizer

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]
 
R

rsarosh

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]


.
 
R

Reginald Blue

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]
 

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