After firing up VS2005, I loaded an application that was originally written with 1.1. In this I had a lot of references that uses:
System.Configuration.ConfigurationSettings.AppSettings[]
I see the Warning:
Warning 5 'System.Configuration.ConfigurationSettings.AppSettings' is obsolete: 'This method is obsolete, it has been replaced by System.Configuration!System.Configuration.ConfigurationManager.AppSettings
However, when trying to use the new ConfigurationManager, it does not display with Intellisense and I gives an error:
Error 5 The type or namespace name 'ConfigurationManager' does not exist in the namespace 'System.Configuration' (are you missing an assembly reference?)
I have also tried to reference the .NET 2.0 System.Configuration dll to no avail.
If I reference the System.configuration dll, then use:
ConfigurationManager.AppSettings[""]
I get an error:
Error 2 The name 'ConfigurationManager' does not exist in the current context
It looks like the IDE is unable to find the .NET 2.0 assemblies.

Signature
MICHAEL CARR
MICHAEL CARR - 02 Nov 2005 00:46 GMT
Using object viewer I see that:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll
has a System.Configuration library
There is also a
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.configuration.dll
After firing up VS2005, I loaded an application that was originally written with 1.1. In this I had a lot of references that uses:
System.Configuration.ConfigurationSettings.AppSettings[]
I see the Warning:
Warning 5 'System.Configuration.ConfigurationSettings.AppSettings' is obsolete: 'This method is obsolete, it has been replaced by System.Configuration!System.Configuration.ConfigurationManager.AppSettings
However, when trying to use the new ConfigurationManager, it does not display with Intellisense and I gives an error:
Error 5 The type or namespace name 'ConfigurationManager' does not exist in the namespace 'System.Configuration' (are you missing an assembly reference?)
I have also tried to reference the .NET 2.0 System.Configuration dll to no avail.
If I reference the System.configuration dll, then use:
ConfigurationManager.AppSettings[""]
I get an error:
Error 2 The name 'ConfigurationManager' does not exist in the current context
It looks like the IDE is unable to find the .NET 2.0 assemblies.
--
MICHAEL CARR
"Jeffrey Tan[MSFT]" - 02 Nov 2005 04:16 GMT
Hi MICHAEL,
Yes, you are right, but this is not a problem. For classes in
System.Configuration namespace, part of the classes reside in System.dll,
while the others reside in System.Configuration.dll, in .Net, assembly will
not go corresponding with the assembly dll.
Specificly, for System.Configuration.ConfigurationManager class, it only
resides in System.Configuration.dll, so we should refer this assembly.
Thanks
Best regards,
Jeffrey Tan
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
MICHAEL CARR - 02 Nov 2005 22:25 GMT
Ok, I reinstalled everything and it looks like it does work. Thanks for the
responses.

Signature
MICHAEL CARR
> Hi MICHAEL,
>
[quoted text clipped - 13 lines]
> Get Secure! - www.microsoft.com/security
> This posting is provided "as is" with no warranties and confers no rights.
"Jeffrey Tan[MSFT]" - 03 Nov 2005 08:00 GMT
Cool, I am glad it works fine now. If you need further help, please feel
free to tell me, thanks
Best regards,
Jeffrey Tan
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
MICHAEL CARR - 02 Nov 2005 01:19 GMT
I had installed the .NET 2.0 Redistributable, then VS2005. I have uninstalled everything and I am going to try install only VS2005 and see what the outcome is.
After firing up VS2005, I loaded an application that was originally written with 1.1. In this I had a lot of references that uses:
System.Configuration.ConfigurationSettings.AppSettings[]
I see the Warning:
Warning 5 'System.Configuration.ConfigurationSettings.AppSettings' is obsolete: 'This method is obsolete, it has been replaced by System.Configuration!System.Configuration.ConfigurationManager.AppSettings
However, when trying to use the new ConfigurationManager, it does not display with Intellisense and I gives an error:
Error 5 The type or namespace name 'ConfigurationManager' does not exist in the namespace 'System.Configuration' (are you missing an assembly reference?)
I have also tried to reference the .NET 2.0 System.Configuration dll to no avail.
If I reference the System.configuration dll, then use:
ConfigurationManager.AppSettings[""]
I get an error:
Error 2 The name 'ConfigurationManager' does not exist in the current context
It looks like the IDE is unable to find the .NET 2.0 assemblies.
--
MICHAEL CARR
"Jeffrey Tan[MSFT]" - 02 Nov 2005 04:09 GMT
Hi MICHAEL,
Thanks for your post.
I am not sure what wrong with your project. After adding
System.Configuration.dll, have you added the following using statement?
using System.Configuration;
In my test sample, I added the reference to System.Configuration.dll, then
adding the using System.Configuration;. I can get the "appSettings" section
in app.config with the code below:
private void Form1_Load(object sender, EventArgs e)
{
// Get the appSettings.
NameValueCollection appSettings =
ConfigurationManager.AppSettings;
// Get the collection enumerator.
IEnumerator appSettingsEnum =
appSettings.Keys.GetEnumerator();
// Loop through the collection and
// display the appSettings key, value pairs.
int i = 0;
Console.WriteLine("App settings.");
while (appSettingsEnum.MoveNext())
{
string key = appSettings.Keys[i];
Console.WriteLine("Name: {0} Value: {1}",
key, appSettings[key]);
i += 1;
}
}
My testing app.config file is:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="CustomSection"
type="Samples.Config.CustomSection,
ConfigurationManager,
Version=1.0.0.0,
Culture=neutralPublicKeyToken=null"
allowDefinition="Everywhere"
allowExeDefinition="MachineToApplication"
restartOnExternalChanges="true" />
</configSections>
<connectionStrings>
<add name="ConnStr1"
connectionString="LocalSqlServer: data source=127.0.0.1;Integrated
Security=SSPI;Initial Catalog=aspnetdb"
providerName="System.Data.SqlClient" />
<add name="ConnStr2"
connectionString="LocalSqlServer: data source=127.0.0.1;Integrated
Security=SSPI;Initial Catalog=aspnetdb"
providerName="System.Data.SqlClient" />
</connectionStrings>
<appSettings>
<add key="AppSetting0"
value="Monday, February 28, 2005 1:27:59 PM" />
<add key="AppSetting1"
value="Monday, February 28, 2005 1:36:40 PM" />
</appSettings>
<CustomSection fileName="default.txt" maxUsers="1000"
maxIdleTime="00:10:00" />
</configuration>
Hope this helps
Best regards,
Jeffrey Tan
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Cowboy (Gregory A. Beamer) - 02 Nov 2005 20:01 GMT
You need to ensure there is a reference to System.Configuration.dll. Beyond that, it should work.
Where are you pulling the app setttings from? Your codeBehind, another class, another project, etc.?

Signature
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
***********************************************
Think Outside the Box!
***********************************************
After firing up VS2005, I loaded an application that was originally written with 1.1. In this I had a lot of references that uses:
System.Configuration.ConfigurationSettings.AppSettings[]
I see the Warning:
Warning 5 'System.Configuration.ConfigurationSettings.AppSettings' is obsolete: 'This method is obsolete, it has been replaced by System.Configuration!System.Configuration.ConfigurationManager.AppSettings
However, when trying to use the new ConfigurationManager, it does not display with Intellisense and I gives an error:
Error 5 The type or namespace name 'ConfigurationManager' does not exist in the namespace 'System.Configuration' (are you missing an assembly reference?)
I have also tried to reference the .NET 2.0 System.Configuration dll to no avail.
If I reference the System.configuration dll, then use:
ConfigurationManager.AppSettings[""]
I get an error:
Error 2 The name 'ConfigurationManager' does not exist in the current context
It looks like the IDE is unable to find the .NET 2.0 assemblies.
--
MICHAEL CARR