Kefash
Kefash

Reputation: 533

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

Upvotes: 9

Views: 21712

Answers (3)

softwaredev
softwaredev

Reputation: 451

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.

Upvotes: 13

Josef Ek
Josef Ek

Reputation: 21

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'

Upvotes: 2

Meeting Attender
Meeting Attender

Reputation: 976

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).

Upvotes: 16

Related Questions