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

ConfigurationManager in Beta2

P: n/a
Hi, I try to read a value from app.config file using this code:

string
s=System.Configuration.ConfigurationManager.AppSet tings["server"].ToString();

I got the compiler error:

Error 1 The type or namespace name 'ConfigurationManager' does not exist in
the namespace 'System.Configuration' (are you missing an assembly
reference?) .

A reference to System.Configuration.dll is added to the project.

My System.Configuration.dll has Version 2.0.50215.44. I there a newer
version ?

Thanks
Michael
Nov 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
I think it should be
string s=System.Configuration.Configuration.AppSettings["server"];
--
Alex Feinman
---
Visit http://www.opennetcf.org
"Michael Debus" <md****@orcasoft.de> wrote in message
news:da*************@news.t-online.com...
Hi, I try to read a value from app.config file using this code:

string
s=System.Configuration.ConfigurationManager.AppSet tings["server"].ToString();

I got the compiler error:

Error 1 The type or namespace name 'ConfigurationManager' does not exist
in the namespace 'System.Configuration' (are you missing an assembly
reference?) .

A reference to System.Configuration.dll is added to the project.

My System.Configuration.dll has Version 2.0.50215.44. I there a newer
version ?

Thanks
Michael


Nov 17 '05 #2

P: n/a
Hello,
System.Configuration.ConfigurationSettings.AppSett ings["server"];
works.

but i'v got a warning:
Warning 2 'System.Configuration.ConfigurationSettings.AppSet tings' is
obsolete: 'This method is obsolete, it has been replaced by
ConfigurationManager.AppSettings'

i tryed to follow Microsofts suggestion to use ConfigurationManager.

Michael
"Alex Feinman [MVP]" <pu*********@alexfeinman.com> schrieb im Newsbeitrag
news:uR**************@TK2MSFTNGP10.phx.gbl...
I think it should be
string s=System.Configuration.Configuration.AppSettings["server"];
--
Alex Feinman
---
Visit http://www.opennetcf.org
"Michael Debus" <md****@orcasoft.de> wrote in message
news:da*************@news.t-online.com...
Hi, I try to read a value from app.config file using this code:

string
s=System.Configuration.ConfigurationManager.AppSet tings["server"].ToString();

I got the compiler error:

Error 1 The type or namespace name 'ConfigurationManager' does not exist
in the namespace 'System.Configuration' (are you missing an assembly
reference?) .

A reference to System.Configuration.dll is added to the project.

My System.Configuration.dll has Version 2.0.50215.44. I there a newer
version ?

Thanks
Michael

Nov 17 '05 #3

P: n/a
Should work in 50215 are you sure you did add areference to
System.Configuration.dll!.
Note that you might get better answers when posting to
http://forums.microsoft.com

Willy.

"Michael Debus" <md****@orcasoft.de> wrote in message
news:da*************@news.t-online.com...
Hello,
System.Configuration.ConfigurationSettings.AppSett ings["server"];
works.

but i'v got a warning:
Warning 2 'System.Configuration.ConfigurationSettings.AppSet tings' is
obsolete: 'This method is obsolete, it has been replaced by
ConfigurationManager.AppSettings'

i tryed to follow Microsofts suggestion to use ConfigurationManager.

Michael
"Alex Feinman [MVP]" <pu*********@alexfeinman.com> schrieb im Newsbeitrag
news:uR**************@TK2MSFTNGP10.phx.gbl...
I think it should be
string s=System.Configuration.Configuration.AppSettings["server"];
--
Alex Feinman
---
Visit http://www.opennetcf.org
"Michael Debus" <md****@orcasoft.de> wrote in message
news:da*************@news.t-online.com...
Hi, I try to read a value from app.config file using this code:

string
s=System.Configuration.ConfigurationManager.AppSet tings["server"].ToString();

I got the compiler error:

Error 1 The type or namespace name 'ConfigurationManager' does not exist
in the namespace 'System.Configuration' (are you missing an assembly
reference?) .

A reference to System.Configuration.dll is added to the project.

My System.Configuration.dll has Version 2.0.50215.44. I there a newer
version ?

Thanks
Michael


Nov 17 '05 #4

P: n/a
Perhaps my suggestion is stupid, but why don't you use the
Properties.Settings class ? It directly maps values in the app.config and
you can read/write using this kind of code :

string s = Properties.Settings.Default.Server;

"Michael Debus" <md****@orcasoft.de> a écrit dans le message de news:
da*************@news.t-online.com...
Hi, I try to read a value from app.config file using this code:

string
s=System.Configuration.ConfigurationManager.AppSet tings["server"].ToString();

I got the compiler error:

Error 1 The type or namespace name 'ConfigurationManager' does not exist
in the namespace 'System.Configuration' (are you missing an assembly
reference?) .

A reference to System.Configuration.dll is added to the project.

My System.Configuration.dll has Version 2.0.50215.44. I there a newer
version ?

Thanks
Michael

Nov 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.