473,729 Members | 2,108 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1957
Iwan,

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

<app name>.exe.confi g

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

"Iwan Petrow" <xx****@abv.b g> wrote in message
news:11******** ************@g1 4g2000cwa.googl egroups.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.b g> wrote in message
news:11******** ************@g1 4g2000cwa.googl egroups.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.b g> wrote in message
news:11******** *************@g 49g2000cwa.goog legroups.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.Curre ntDomain.GetDat a("APP_CONFIG_F ILE").ToString( );

If you are creating your own app domain you can specify the name for the
ConfigurationFi le. 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.Exe cutablePath + ".config"

Regards - Octavio

"Iwan Petrow" <xx****@abv.b g> escribió en el mensaje
news:11******** ************@g1 4g2000cwa.googl egroups.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
3019
by: Maxim Khesin | last post by:
I want to have a config file with my python proggie, satisfying the following requirements: 1) support key->(value, default) 2) simple and intuitive to read and edit 3) easyly readable into a python datastructure (a dictionary?) 4) not requiring any heavy libraries needed (I am distributing my proggie as a py2exe executable and do not want to bloat the size) can you guys suggest some format for this? thanks, max
2
933
by: Suresh Gladstone | last post by:
Hi, This is a bit with versioning and installation of the .NET dlls. I want to perform the following, 1. A third party application will be invoking my .NET dll through COM interop . For this I have used Regasm and registered the assembly in the registry with CODEBASE option. eg: regasm myDll.dll /tlb:myDll.tlb /codebase
2
3692
by: Richard | last post by:
Hi, I'm having trouble setting up a config file based trace switch & listener. I added an application config file to my console based C# program using the "Add New Application Config File" button from solution explorer. My config file is composed of the following, which is almost a verbatum cut & paste from MSDN help: --------------------------------------------------------------------------- <?xml version="1.0" encoding="utf-8" ?>...
9
8276
by: ALI-R | last post by:
Hi,, I have two questions : 1) Is it mandatory that config file of a desktop application must be App.config 2) Is it possible to update config file in your code?? thanks for your help. ALI
1
5358
by: vkrasner | last post by:
It works with VS2003 and does not in VS2005: in VS2003 : string sMyvalue = ConfigurationSettings.AppSettings; in VS2005 (does not work!!) string sMyvalue = ConfigurationManager.AppSettings; Anybody able to give me idea how-to read by C# element which I add to the machine.config into the new single section?
5
2934
by: who be dat? | last post by:
Hello all. I'm writing an application that is writing trace information that can be viewed in trace.axd. I would like to rename this and use a different name specific to my application. I know the name of this is set in machine.config. I was hoping it would be possible to change this in web.config. I got it to work, kind of. Good news is I can change the name in my web.config file. Bad news is that trace.axd still works meaning I can...
1
2291
by: savajx1 | last post by:
I am using the new "web deployment addin" in VS 2005 to output my web site. The web site is correctly output (assemblies generated in the \bin subdirectory). The web site on my developement machine (WIN 2K OS) can be accessed and works correctly from other workstations (i.e no problem here). The problem: When deploying the web site (by just copying the correct subdirectories and creating the application in IIS 6) on 2 dffering Windows...
1
5728
bartonc
by: bartonc | last post by:
Still have to prepend "default" when assigning variables to this class, but it now allows val = inst.vaule:"""Encapuslate a Default Values Object and Config File""" from inspect import getmembers import wx class DefaultValueHolder(object): """Intended for use with wxConfig (or maybe _winreg) to set up and/or get registry key names and values. Name attrs as default*. "default" will be stripped of when reading and...
3
10599
by: Blasting Cap | last post by:
I am working on a web app that I want to be able to use a separate config file on, in addition to the web.config file that's already working in the application. If I put the following in the web.config file (VS 2005, Framework 2.0), I can retrieve the values fine: <appSettings> <add key="fileInputFolder" value="C:\National City Downloads\test"/> <add key="fileTransaction" value="\Transactions\"/>
2
5391
by: Johnson | last post by:
I'm trying to fix a "sub optimal" situation with respect to connection string management. Your thoughtful responses will be appreciated. I just started with a new client who has a bunch of legacy ASP.NET applications that all manage connection strings in Web.config the same way, like this: This client has one Web.config file per application, and that one Web.config file is duplicated across all environments (i.e., dev machines, test,...
0
8931
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9428
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9293
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9221
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9162
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6028
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4799
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3246
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.