By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,948 Members | 1,663 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,948 IT Pros & Developers. It's quick & easy.

.Net 2.0 app.config / deployment

P: n/a
Hello
I created a dll assembly unsing the settings (only application settings). I
read a lot a lot about the new settings concept, but I still don't understand
it.

The settings are in two places. First in the settings file which can be
edited a gui, second in the app.config file which is used in the development
enviornment. So far so good... but...

When I deploy my application and have a <dll filename>.config file in the
same directory where my dll file is, it does not work when I change settings
in the .config file. It always uses the default settings which are still from
the development enviornment.

How can I make my dll use the settings from the .config file and not the
default settings?

Help you very much,
Peter
Jul 25 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Peter,

When you have a config file, you need to place your settings in the
config file for the executable. Libraries could not (and should not, IMO)
have a config file of their own, since they are working in the larger
context of the application that references them.

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

"Peter" <Pe***@discussions.microsoft.comwrote in message
news:BD**********************************@microsof t.com...
Hello
I created a dll assembly unsing the settings (only application settings).
I
read a lot a lot about the new settings concept, but I still don't
understand
it.

The settings are in two places. First in the settings file which can be
edited a gui, second in the app.config file which is used in the
development
enviornment. So far so good... but...

When I deploy my application and have a <dll filename>.config file in the
same directory where my dll file is, it does not work when I change
settings
in the .config file. It always uses the default settings which are still
from
the development enviornment.

How can I make my dll use the settings from the .config file and not the
default settings?

Help you very much,
Peter

Jul 25 '06 #2

P: n/a
Peter,

Try:

Configuration = ConfigurationManager.OpenExeConfiguration(
Assembly.GetExecutingAssembly().Location );

HTH
Andy

Peter wrote:
Hello
I created a dll assembly unsing the settings (only application settings). I
read a lot a lot about the new settings concept, but I still don't understand
it.

The settings are in two places. First in the settings file which can be
edited a gui, second in the app.config file which is used in the development
enviornment. So far so good... but...

When I deploy my application and have a <dll filename>.config file in the
same directory where my dll file is, it does not work when I change settings
in the .config file. It always uses the default settings which are still from
the development enviornment.

How can I make my dll use the settings from the .config file and not the
default settings?

Help you very much,
Peter
Jul 25 '06 #3

P: n/a
Ian
That's an interesting point. I am trying to store configuration information
for a data layer library that needs to be configured to access different
databases/servers, with stored userId and password, etc. How can I do this
for such 'behind the scenes' library classes without using a different config
file for each different project/module that calls the data access classes?

Should I be using machine.config or something?

Thanks

Ian

"Nicholas Paldino [.NET/C# MVP]" wrote:
Peter,

When you have a config file, you need to place your settings in the
config file for the executable. Libraries could not (and should not, IMO)
have a config file of their own, since they are working in the larger
context of the application that references them.

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

"Peter" <Pe***@discussions.microsoft.comwrote in message
news:BD**********************************@microsof t.com...
Hello
I created a dll assembly unsing the settings (only application settings).
I
read a lot a lot about the new settings concept, but I still don't
understand
it.

The settings are in two places. First in the settings file which can be
edited a gui, second in the app.config file which is used in the
development
enviornment. So far so good... but...

When I deploy my application and have a <dll filename>.config file in the
same directory where my dll file is, it does not work when I change
settings
in the .config file. It always uses the default settings which are still
from
the development enviornment.

How can I make my dll use the settings from the .config file and not the
default settings?

Help you very much,
Peter


Jul 25 '06 #4

P: n/a
Ian,

You could use machine.config, and that will set the "default" for that
machine, should there be no section in the application configuration file.
Those settings will always override the machine.config settings.

If you have your application libraries being used in many different
areas, and you want to set the defaults through a config file, then
machine.config is a good way to do it.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ian" <ia********@NOSPAM.aol.comwrote in message
news:CD**********************************@microsof t.com...
That's an interesting point. I am trying to store configuration
information
for a data layer library that needs to be configured to access different
databases/servers, with stored userId and password, etc. How can I do this
for such 'behind the scenes' library classes without using a different
config
file for each different project/module that calls the data access classes?

Should I be using machine.config or something?

Thanks

Ian

"Nicholas Paldino [.NET/C# MVP]" wrote:
>Peter,

When you have a config file, you need to place your settings in the
config file for the executable. Libraries could not (and should not,
IMO)
have a config file of their own, since they are working in the larger
context of the application that references them.

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

"Peter" <Pe***@discussions.microsoft.comwrote in message
news:BD**********************************@microso ft.com...
Hello
I created a dll assembly unsing the settings (only application
settings).
I
read a lot a lot about the new settings concept, but I still don't
understand
it.

The settings are in two places. First in the settings file which can be
edited a gui, second in the app.config file which is used in the
development
enviornment. So far so good... but...

When I deploy my application and have a <dll filename>.config file in
the
same directory where my dll file is, it does not work when I change
settings
in the .config file. It always uses the default settings which are
still
from
the development enviornment.

How can I make my dll use the settings from the .config file and not
the
default settings?

Help you very much,
Peter



Jul 25 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.