We were developing a console application to connect to our SharePoint online sites. Here we have save the credentials inside App.Config file and we were retrieving like below:
private static string GetSPOAccountName()
{
try
{
return ConfigurationManager.AppSettings["SPOAccount"];
}
catch
{
throw;
}
}
But it shows the error like below:
The name 'ConfigurationManager' does not exists in the current context.
Solution:
To resolve this issue we need to add System.Configuration dll. If you have .Net framework installed, then we can add it from local drive from the .NET tab.
But here I have added from NuGet package. Right click on the References folder -> Manage NuGet Packages... like below:
Then in the NuGet screen, search for System.Configuration in the Browse tab and then from there add select System.Configuration.Abstractions and click on Install like below:
Then the error will not come. Hope this will be helpful.
private static string GetSPOAccountName()
{
try
{
return ConfigurationManager.AppSettings["SPOAccount"];
}
catch
{
throw;
}
}
But it shows the error like below:
The name 'ConfigurationManager' does not exists in the current context.
Solution:
To resolve this issue we need to add System.Configuration dll. If you have .Net framework installed, then we can add it from local drive from the .NET tab.
But here I have added from NuGet package. Right click on the References folder -> Manage NuGet Packages... like below:
Then in the NuGet screen, search for System.Configuration in the Browse tab and then from there add select System.Configuration.Abstractions and click on Install like below:
Then the error will not come. Hope this will be helpful.
0 on: "the name configurationmanager does not exist in the current context"