AstroGuy
asked on
ConfigurationManager problems
I keep getting the following error message no matter what I try
The name 'ConfigurationManager' does not exist in the current context
The name 'ConfigurationManager' does not exist in the current context
using System;
using System.Collections;
using System.Collections.Specialized;
using System.Text;
using System.Configuration;
//using System.Configuration.Assemblies;
namespace C9_1AllAppSettings490
{
class Program
{
static void Main(string[] args)
{
NameValueCollection AllAppSettings = ConfigurationManager.AppSettings;
Int32 Counter = 0;
IEnumerator SettingsEnumerator = AllAppSettings.Keys.GetEnumerator();
while (SettingsEnumerator.MoveNext())
{
Console.WriteLine("Item: {0} Value: {1}", AllAppSettings.Keys[Counter], AllAppSettings[Counter]);
}
}
}
}
ASKER
jinal,
"using System.Configuration;" is plainly visible in the code above. /the system will not accept
using System.Configuration.dll
What are you refering to ??;
"using System.Configuration;" is plainly visible in the code above. /the system will not accept
using System.Configuration.dll
What are you refering to ??;
Namespaces can span across assemblies - although you can include this namespace without any errors the class ConfigurationManager / some of its members (possible due to partial classes) are not available until you reference the assembly System.Configuration.dll.
As stated by Jinal you need to add a reference to System.Configuration.dll and then the System.Configuration.Confi gurationMa nager will become available.
Adding and assembly reference and using a namespace are two different things.
http://msdn.microsoft.com/en-us/library/wkze6zky(VS.80).aspx
As stated by Jinal you need to add a reference to System.Configuration.dll and then the System.Configuration.Confi
Adding and assembly reference and using a namespace are two different things.
http://msdn.microsoft.com/en-us/library/wkze6zky(VS.80).aspx
ASKER
The code you see is all the code there is.
When I add using System.Configuration.dll.I get and error.
I don't understand.
When I add using System.Configuration.dll.I
I don't understand.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sorry Jinal that it took so long to get back to you.
System.Configuration.dll refrence is missing.