Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to solve "The 'configuration' element is not declared" warning message in C#.net

This warning generated from my app.config file is driving me crazy and I have been searching without getting any real answer as to why this is the case. Here is the code.

enter image description here

Any help would be greatly appreciated

like image 462
Kefash Avatar asked Aug 27 '14 04:08

Kefash


3 Answers

From the main menu in VS, choose XML > Schemas... (must have XML file open in IDE to see the XML menu item). In the window that pops up, find the entry for DotNetConfig.xsd (should be first item), and select the checkmark in the Use column for that entry. Then click OK.

like image 171
softwaredev Avatar answered Oct 14 '22 22:10

softwaredev


I had the same problem, this solved it:

From the Visual Studio menu, click XML>Schemas...

Look for DotNetConfig.xsd

Make sure you check 'use this schema'

And 'Ok'

like image 35
Josef Ek Avatar answered Oct 14 '22 22:10

Josef Ek


I fixed the problem for VS2013 and .NET 4.6 targeting projects by editing C:\Program Files (x86)\Microsoft Visual Studio 12.0\Xml\Schemas\catalog.xml.

I modified existing line:

<Association extension="config" schema="%InstallRoot%/xml/schemas/%LCID%/dotNetConfig.xsd"   condition="starts-with($TargetFrameworkMoniker, '.NETFramework,Version=v4.5.') or $TargetFrameworkMoniker = ''" />

to

<Association extension="config" schema="%InstallRoot%/xml/schemas/%LCID%/dotNetConfig.xsd"   condition="starts-with($TargetFrameworkMoniker, '.NETFramework,Version=v4.5.') or starts-with($TargetFrameworkMoniker, '.NETFramework,Version=v4.6')" />

Closed and reopened VS2013 and intellisense in both app.config and web.config files started to work again (with .NET 4.6 targeting projects).

like image 23
Meeting Attender Avatar answered Oct 14 '22 20:10

Meeting Attender