473,401 Members | 2,146 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Custom Configuration Files...

Is it possible to create a custom configuration file (other than app.config)
that can be processed by classes in the System.Configuration namespace?

I have seen a ton of articles that talk about custom sections (inside the
app.config file) but I would like to make an entirely new config file. I
opened a custom config file with the ConfigurationManager class but it seemd
as if it ignored all of the content in the config file.

Is there any decent documentation that covers this topic?

Thank you,

Jason Richmeier
May 10 '06 #1
3 5588
For any app domains that you create you can use
AppDomainSetup.ConfigurationFile but since you do not control the creation
of your default application domain you cannot change the name. A thought
might be that you could spawn off a secondary domain from the main domain
(changing the name of the config)

Another idea would be to use ConfigurationManager.OpenExeConfiguration(file)
http://msdn2.microsoft.com/en-us/library/ms224437.aspx which would return
you a seperate Configuration object for the file.

Cheers,

Greg Young
MVP - C#

"Jason Richmeier" <js*@noemail.noemail> wrote in message
news:02**********************************@microsof t.com...
Is it possible to create a custom configuration file (other than
app.config)
that can be processed by classes in the System.Configuration namespace?

I have seen a ton of articles that talk about custom sections (inside the
app.config file) but I would like to make an entirely new config file. I
opened a custom config file with the ConfigurationManager class but it
seemd
as if it ignored all of the content in the config file.

Is there any decent documentation that covers this topic?

Thank you,

Jason Richmeier

May 10 '06 #2
The overload of the OpenExeConfiguration method that you mentioned is the one
that I am using.

Here is what I did yesterday evening. In order to get something to work
quickly, I downloaded the sample application from the current issue of MSDN
magazine (about configuration files). I replaced the line of code

config =
ConfigurationManager.OpenExeConfiguration(Configur ationUserLevel.None)

with

config = ConfigurationManager.OpenExeConfiguration("d:\test .config")

I have a file named test.config with the exact same contents as the
app.config in the application located a "d:\test.config". When I run the
application, the custom sections are ignored. When I run the application
with the original line of code, the custom sections are processed.

Is there something I am doing wrong with this?

Thank you,

Jason Richmeier

"Greg Young" wrote:
For any app domains that you create you can use
AppDomainSetup.ConfigurationFile but since you do not control the creation
of your default application domain you cannot change the name. A thought
might be that you could spawn off a secondary domain from the main domain
(changing the name of the config)

Another idea would be to use ConfigurationManager.OpenExeConfiguration(file)
http://msdn2.microsoft.com/en-us/library/ms224437.aspx which would return
you a seperate Configuration object for the file.

Cheers,

Greg Young
MVP - C#

"Jason Richmeier" <js*@noemail.noemail> wrote in message
news:02**********************************@microsof t.com...
Is it possible to create a custom configuration file (other than
app.config)
that can be processed by classes in the System.Configuration namespace?

I have seen a ton of articles that talk about custom sections (inside the
app.config file) but I would like to make an entirely new config file. I
opened a custom config file with the ConfigurationManager class but it
seemd
as if it ignored all of the content in the config file.

Is there any decent documentation that covers this topic?

Thank you,

Jason Richmeier


May 10 '06 #3
Can you put up a simple example?

Cheers,

Greg Young
"Jason Richmeier" <js*@noemail.noemail> wrote in message
news:3D**********************************@microsof t.com...
The overload of the OpenExeConfiguration method that you mentioned is the
one
that I am using.

Here is what I did yesterday evening. In order to get something to work
quickly, I downloaded the sample application from the current issue of
MSDN
magazine (about configuration files). I replaced the line of code

config =
ConfigurationManager.OpenExeConfiguration(Configur ationUserLevel.None)

with

config = ConfigurationManager.OpenExeConfiguration("d:\test .config")

I have a file named test.config with the exact same contents as the
app.config in the application located a "d:\test.config". When I run the
application, the custom sections are ignored. When I run the application
with the original line of code, the custom sections are processed.

Is there something I am doing wrong with this?

Thank you,

Jason Richmeier

"Greg Young" wrote:
For any app domains that you create you can use
AppDomainSetup.ConfigurationFile but since you do not control the
creation
of your default application domain you cannot change the name. A thought
might be that you could spawn off a secondary domain from the main domain
(changing the name of the config)

Another idea would be to use
ConfigurationManager.OpenExeConfiguration(file)
http://msdn2.microsoft.com/en-us/library/ms224437.aspx which would return
you a seperate Configuration object for the file.

Cheers,

Greg Young
MVP - C#

"Jason Richmeier" <js*@noemail.noemail> wrote in message
news:02**********************************@microsof t.com...
> Is it possible to create a custom configuration file (other than
> app.config)
> that can be processed by classes in the System.Configuration namespace?
>
> I have seen a ton of articles that talk about custom sections (inside
> the
> app.config file) but I would like to make an entirely new config file.
> I
> opened a custom config file with the ConfigurationManager class but it
> seemd
> as if it ignored all of the content in the config file.
>
> Is there any decent documentation that covers this topic?
>
> Thank you,
>
> Jason Richmeier


May 10 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ole Hanson | last post by:
I would like to be able to generate documentation for a custom configuration file (xml) to enable future support engineers to understand applicable values to the various elements inside the...
5
by: rdcpro | last post by:
In reading MSDN docs on creating custom Configuration sections, I found this page: ...
1
by: UJ | last post by:
I've got two apps that need to share a configuration file. How can I do that? It seems like ConfigurationSettings has built in to it to figure out the name of the file.
3
by: Laser Lu | last post by:
Hello, everybody, In order to avoid making web.config lengthy, I just moved some custom configuration settings out from web.config, and centralized them into an xml file, which names data.config....
6
by: Jeff Hegedus | last post by:
I have a dll that requires some configuration data. I put the configuration data in a custom configuration section in a config file that is loaded in the installation folder of the dll. If I...
7
by: =?Utf-8?B?RG91Z2llIEJyb3du?= | last post by:
Hi I've written custom configuration section (inherits from System.Configuration.ConfigurationSection) to simplify the contents of the config file and to make life easier when accessing them in...
0
by: =?Utf-8?B?UGhpbGlw?= | last post by:
I have a web.config custom configuration section using asp.net 2.0 configuration APIs. My custom configuration section inherits from System.Configuration.ConfigurationSection. I have a IIS root...
1
by: =?Utf-8?B?SmFzb24gUmljaG1laWVy?= | last post by:
This may have been addressed in another post but I was unable to find what I was looking for. I am trying to create a custom configuration section that is element-centric instead of...
4
by: David Williams | last post by:
I am familiar with creating custom configuration settings and accessing them. However, for a current requirement, I need to control the various settings in my custom configuration section by...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.