2

I was wondering if there is a way to disable the schema validation of the web.config file when building the solution? I am using Visual Studio 2013. I see a lot of messages like the following, which are a bit annoying:

...
Could not find schema information for the element 'loggingConfiguration'
Could not find schema information for the attribute 'name'
Could not find schema information for the attribute 'tracingEnabled'
Could not find schema information for the attribute 'defaultCategory'
...

Web.config schema messages

I know it is possible to suppress specific warnings, I was wondering if there is something similar for these kind of messages?

Rui Jarimba
  • 11,166
  • 11
  • 56
  • 86

1 Answers1

1

I was wondering if there is something similar for these kind of messages?

These are the messages from Visual Studio. They mean that the IDE cannot find schemas for our sections, so the Intellisense will not work with them.

In general, these messages do not affect the control's functionality, so you can just ignore them. If there are strict requirements to remove all warnings and messages in VS, you can follow below steps:

  1. In Visual Studio, open your web.config file.
  2. Double click web.config, go to the "XML" menu and select "Create Schema". This action should create a new file called or "web.xsd".
  3. Save the schema in an apropriate place(for example,the root of the project).
  4. Go back to your web.config and double click it, see the "Properties" tab of the web.config file where there is a property named Schemas. Make sure the xsd you just generated is referenced in the Schemas property. If it's not there then add it.

If you need further assistance, please reactivate this ticket: How to fix Error: “Could not find schema information for the attribute/element” by creating schema

Leo Liu
  • 71,098
  • 10
  • 114
  • 135
  • 1
    Hi @Leo-MSTF, sorry for the late reply. I saw other posts where people were suggesting to create the schema for `web.config`, but I was expecting to find a simpler way to do it, such as using a flag or suppress a specific kind of warning using MSBuild. Using your solution means I will have to add the schema file to source control and regenerate it every single time new elements are added. Oh, and I'd have to do it multiple times if I had several `web.config` files in the solution. – Rui Jarimba Aug 08 '17 at 06:00
  • @RuiJarimba, if you have several web.config, this method does not seem perfect.I have no other better solution temporary. Have you try the methods from reexmonkey: https://stackoverflow.com/a/14965640/1016343 and Pressacco:https://stackoverflow.com/a/7517532/1016343 – Leo Liu Aug 09 '17 at 02:11