471,315 Members | 2,262 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,315 software developers and data experts.

config file name

Hi,

I use Net Framework 1.1 and windows forms.

How could I take the name of the configuration file at runtime?

Thanks.

Jan 18 '06 #1
7 1884
Iwan,

What do you mean the name of the config file? The name of the file
should be:

<app name>.exe.config

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Iwan Petrow" <xx****@abv.bg> wrote in message
news:11********************@g14g2000cwa.googlegrou ps.com...
Hi,

I use Net Framework 1.1 and windows forms.

How could I take the name of the configuration file at runtime?

Thanks.

Jan 18 '06 #2
Hi,

The config used by the framework is named always the same ,
YourProgramName.exe.config , where YourProgramName.exe is the name of the
executable of your app.
you add a config file by selecting "config file" from the add item to the
project
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Iwan Petrow" <xx****@abv.bg> wrote in message
news:11********************@g14g2000cwa.googlegrou ps.com...
Hi,

I use Net Framework 1.1 and windows forms.

How could I take the name of the configuration file at runtime?

Thanks.

Jan 18 '06 #3
So there is no possibility the name would be different from
YourProgramName.exe.config ?

Thanks.

Jan 18 '06 #4
Hi,

"Iwan Petrow" <xx****@abv.bg> wrote in message
news:11*********************@g49g2000cwa.googlegro ups.com...
So there is no possibility the name would be different from
YourProgramName.exe.config ?
You may use another name, but then it would be your responsability to
process it.

out of curiosity, what is wrong with the name in the first place? , this is
not the first time people ask this and I'm curious of why

Thanks.

Jan 18 '06 #5
Iwan Petrow wrote:
So there is no possibility the name would be different from
YourProgramName.exe.config ?


That is the default. You can get the current file name with the
following code in your application:

AppDomain.CurrentDomain.GetData("APP_CONFIG_FILE") .ToString();

If you are creating your own app domain you can specify the name for the
ConfigurationFile. You can not change the config file after the
application domain has finished its first bind. More info can be found at:

http://msdn.microsoft.com/library/en...nfiletopic.asp
--
Tom Porterfield
Jan 18 '06 #6
If you add an app.config file to the project, the resultant name of the file
after a build will always be the name of the executable plus ".config".

If you actually need something else, you would need to implement your own
configuration file scheme and configuration settings reader.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Iwan Petrow" wrote:
So there is no possibility the name would be different from
YourProgramName.exe.config ?

Thanks.

Jan 18 '06 #7
Hi,

Application.ExecutablePath + ".config"

Regards - Octavio

"Iwan Petrow" <xx****@abv.bg> escribió en el mensaje
news:11********************@g14g2000cwa.googlegrou ps.com...
Hi,

I use Net Framework 1.1 and windows forms.

How could I take the name of the configuration file at runtime?

Thanks.

Jan 18 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by Maxim Khesin | last post: by
2 posts views Thread by Suresh Gladstone | last post: by
2 posts views Thread by Richard | last post: by
9 posts views Thread by ALI-R | last post: by
1 post views Thread by vkrasner | last post: by
1 post views Thread by savajx1 | last post: by
3 posts views Thread by Blasting Cap | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.