Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to use C# ConfigurationManager

I have the following code:

using System.Configuration;

namespace test
{
  public partial class MyService : ServiceBase
  {
    public  static ReadConnectionStrings()
    {                        
      ConnectionStringSettingsCollection connections =
          ConfigurationManager.ConnectionStrings;

However, it doesn’t recognise ConfigurationManager. I took this code directly from here

So I’m clearly missing something, but can’t identify what.

like image 936
Paul Michaels Avatar asked Oct 06 '10 14:10

Paul Michaels


People also ask

Why is type C not working?

Make sure the cable supports the same USB-C features as the connected device. Make sure the device or dongle is connected directly to your PC (or phone). Make sure the device or dongle is connected to the USB-C port on your PC (or phone) that supports the correct Alternate Mode.


Video Answer


1 Answers

Do you have a reference to System.Configuration? It's not added to .NET projects by default.

like image 152
Steve Danner Avatar answered Oct 16 '22 11:10

Steve Danner