0
  1. For missing namespace, I added a reference to relevant project which contains the namespace.

  2. Code detected the reference and go stable

    enter image description here

  3. I then compiled the code.

  4. Again, I am getting the same error and the code became like this

    enter image description here

Please help ! I have no clue what is going on. This ConfigurationManager is being used since ages in our solution (which has many projects). I have created a project in the solution and there is where I am getting this error


I tried these, but didn't help

Community
  • 1
  • 1
SimpleGuy
  • 2,764
  • 5
  • 28
  • 45
  • What namespace you like to add? – Ali Vojdanian Feb 24 '15 at 09:40
  • @aliboy38 I added a project which contains namespace `NamespaceA.NamespaceB` – SimpleGuy Feb 24 '15 at 09:41
  • you want to add ConfigurationManager namespace? – Ali Vojdanian Feb 24 '15 at 09:42
  • `ConfigurationManager` is a class in `NamespaceA.NamespaceB` – SimpleGuy Feb 24 '15 at 09:44
  • `ConfigurationManager` might be in `NamespaceA.NamespaceB`, but it in no way means that it is contained within the assembly you have referenced. It may well be in another assembly that needs to be referenced as well. – pixelbadger Feb 24 '15 at 09:45
  • @pixelbadger I have added reference to a project which has that namespace. And on adding a reference to that project, it gets detected by Intellisense (see snaphot in question). BUt when i build the references go away and error comes and after that Intellisense also cannot find reference – SimpleGuy Feb 24 '15 at 09:48
  • @SimpleGuy What I'm saying is that there may be *other* dependencies required to reference that one project. If `ConfigurationManager` relied on other classes in other projects, you would need to reference those projects too. – pixelbadger Feb 24 '15 at 09:52
  • @Grx70 I resolved it. I went to Project Properties > Application > target Framework as `.NET 4 Framework Client profile`. I changed it to `.NET 4 Framework` – SimpleGuy Feb 24 '15 at 10:37
  • @pixelbadger Thanks for help. I resolved it in above way. See above comment – SimpleGuy Feb 24 '15 at 10:37

1 Answers1

1

For this issue you have to add ConfigurationManager namespace to your project.

ConfigurationManager is part of System.Configuration in .NET. You should add a reference to your project if you want to use ConfigurationManager after .NET 2.0. As you mentioned you're using .NET 4.0 so you must add a reference to the System.Configuration dll.

Then you should try using System.Configuration.ConfigurationManager.

Update : If you have custom made class so you probably made a mistake while making or using the class.

Read this article may help you.

Hope it helps

Ali Vojdanian
  • 2,067
  • 2
  • 31
  • 47
  • This `ConfigurationManager` is custom made class – SimpleGuy Feb 24 '15 at 09:47
  • maybe that's the problem ? Isn't there a conflict ? If you rename it, does it work ? – thomasb Feb 24 '15 at 09:50
  • 1
    @aliboy38 Thanks for help. I resolved it. I went to Project Properties > Application > target Framework as `.NET 4 Framework Client profile`. I changed it to `.NET 4 Framework` – SimpleGuy Feb 24 '15 at 10:38