Reference to ConfigurationManager class generates compile errors in .net 4.5

$0
=
$0
+
$0
No specific Bitcoin Bounty has been announced by author. Still, anyone could send Bitcoin Tips to those who provide a good answer.
0

I'm using this namespace:

using System.Configuration;

and here is my code:

private static string _smtpServer = ConfigurationManager.AppSettings["SMTPServer"];

However I am getting a compilation error saying that "ConfigurationManager" does not exist.

Thanks

1 Answer - total earned - 0 BTC ($0 USD)

1
=
0
=
$0
Internet users could send Bitcoin Tips to you if they like your answer!

Including "using" statement is not enough. In order for compiler to find your target class (ConfigurationManager), you need to REFERENCE the assembly that contains that class definition. In your case, this assembly is known as "System.Configuration".

To add a reference to the above mentioned assembly:

  1. Right click on your project;
  2. Click to "Add Reference";
  3. Select the .NET Tab;
  4. Select System.Configuration

This should make it work. Cheers!

SEND BITCOIN TIPS
0

Post Answer