Again, I came across those annoying 'Could not find schema-information for ... ' messages.
I do not like warnings and information messages in my projects, so I had the urge to solve these issues.
I was playing a bit with the 'Settings' class in a Windows Forms application. I added a user-scope setting, and I received this warning from Visual Studio.NET 2005:
The requirePermission attribute is not declared
After some crawling on the web, I've found an article written by Peter Richie. It appears to be a negligency from Microsoft: it seems that the DotNetConfig.xsd schema-file is not complete. Peter Richie has adapted this XSD file, so you can download this file and replace the original file with his one. By doing so, I got rid of this error.
Click here for Peter's article.
I can't understand how Microsoft could be so sloppy to not deliver a correct xsd.
Then, I was still annoyed by some 'Information messages' Visual Studio gave me. These were due to a custom configuration section for NHibernate I have in my app.config file.
This is a snippet from my App.Config file:
<configSections>
<section name="nhibernate"
type="System.Configuration.NameValueSectionHandler"/>
</configSections>
<nhibernate>
<add key="hibernate.connection.provider"
value="NHibernate.Connection.DriverConnectionProvider"/>
...
</nhibernate>
The 'information message' here told my that a schema definition for the element nhibernate couldn't be found. Off-course, this is not an error, but... I find those things annoying.
So, to get rid of those messages, I've created a simple XSD that describes this 'nhibernate' section. (You can download this XSD here). I've copied this xsd to the Program Files\Microsoft Visual Studio 8\Xml\Schemas\ directory. The next step I had to do, was to include this schema in the DotNetConfig.xsd file.
So, in the same directory, edit the DotNetConfig.xsd file and add this line:
<xs:include schemaLocation="nhibernate_configuration.xsd"/>
If you have a rather complex custom Configuration Section in your App.Config file, you can create your own XSD for it.
You're not only going to get rid of those 'could not find schema information...' messages, but you'll also have Intellisense for your custom configuration section in VS.NET 2005 as well!
Click here for my first post about this problem.