So in this particular C# helper, I have the following listed at the top of the file:
using System.Configuration;
When I try to reference it in the c# code (within the same file),
static readonly string apiKey = ConfigurationManager.AppSettings["apiKey"];
The name 'ConfigurationManager' does not exist in the current context.
Why would this be? System.Configuration
is used all over the place in this application, but isn't being recognized in this particular file.
If I go to the Manage NuGet packages panel and search 'configuration manager', the top choice is 'System.Configuration.ConfigurationManager'. Even the oldest available version has a .NETFramework dependency of 4.6.1, whereas this application uses 4.5.1 so downloading it is not possible.
Is there something I am overlooking here?
Any and all input appreciated.
if you are getting error in the Add References window, try editing the .csproj to add the reference (along with other references) in the Reference ItemGroup like:
<ItemGroup>
<Reference Include="System.Configuration" />
</ItemGroup>