1

I referred this to add a config file for console project. I have successfully added app.config but do not know how to use it. I cannot reference System.Configuration.ConfigurationManager.AppSettings;

It produces the following error,

The typename or namespace name 'ConfigurationManager' does not exist in the 'System Configuration(' are you missong and assembly reference?)'

I right-clicked on dependencies but cannot see the option 'add references'.

Struse
  • 75
  • 3
  • 13
  • What do you mean you can not reference? Please provide the error message and more information. – Menefee Oct 02 '18 at 18:09
  • Updated the compiler error – Struse Oct 02 '18 at 18:12
  • You need to add a reference to `assembly System.Configuration.dll` in your project. See [The name 'ConfigurationManager' does not exist in the current context](https://stackoverflow.com/questions/1274852/the-name-configurationmanager-does-not-exist-in-the-current-context). – paulsm4 Oct 02 '18 at 18:20
  • I am working on Mac and I don't see an option 'Add references' but 'add packages' that takes me to nuget. I am a kind of new to C# and working with mac. – Struse Oct 02 '18 at 18:31

1 Answers1

2

Right click on project -> Click "Add" -> Click "Add Nuget Packages"

enter image description here

This will open up a new window to add Nuget packages.

Type "System.Configuration" in search box. You will see a package "System.Configuration.ConfigurationManager".

Add this package, this will resolve your problem.

enter image description here

Aparna Gadgil
  • 410
  • 4
  • 9