Click here to Skip to main content
14,455,062 members

How to Add Custom XSD Validation Intellisense in Visual Studio

Rate this:
5.00 (2 votes)
Please Sign up or sign in to vote.
5.00 (2 votes)
15 Feb 2015CPOL
This tip shows how you can add an XSD schema in Visual Studio to enable XML intellisense.


This tip will show you how you can add an XSD to Visual Studio in order to enable Intellisense for that particular XSD when creating an XML file.


For many integration solutions, we still rely heavily on parsing XML from some source. Often a SFTP location or file share or even a direct download link.

The issue with XML is that it is often quite prone to user errors. The XML needs to be formed just for the XML Parser to be able to process it. To make this easier, we came up with the XSD. Basically, it's a file with a definition containing the set of rules on which the XML should comply to.

Creating an XSD using Visual Studio is actually quite easy as well and it is useful if for example you have already defined a set of classes/entities and want just an XML file that follows your entity hierarchy and do a simple serialize/deserialize of the XML. (see:

But what if you want to write an XML in Visual Studio and ensure you are complying to the XSD and perhaps even get some intellisense?

Add XSD to Schema Validation

This is where this tip comes in. I decided to add this as I have stumbled at it when I had to write an example XML after I found that the third party I had send an XSD to implement had made lots of errors.

Checking to see if an XML matches validation can easily be done by validating it online. I've searched on Google and found, but there were a whole bunch of validators. There's no need to write some C# code yourself to validate an XSD for these kinds of tests.

To add your XSD to the Schema Validation, you merely have to open the XML editor. For example, open the XML file in Visual Studio. Then once inside, go to properties and click on the Schemas Button.

Image 1

Or in Visual Studio 2013, you can go to Schemas directly from the XML Menu. I've not noticed this in Visual Studio 2010 for example.

One you open the XML Schema, you will see a large list of XSD Schemas. The one which has a tick box in the "Use" column will be actually used in the XML that you are working on. So make sure that when you've added the XSD that you also set the tick on "Use".

Image 2

Once you are working on the XML file than at least Visual Studio 2013, you can also just click F12 and you will be navigated directly to the XSD part that is relevant for that XML node you came from.

Also, there is no need for running some separate XML validator like the link I showed in the beginning as we now have IntelliSense and so also get warnings if the XML is not compliant to the used XSD Schemas.

Image 3

All in all, I found this a very useful way to ensure that the XML samples I sent to the third parties that need to implement my XSD are valid.

Hopefully, you will find this tip useful.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Netherlands Netherlands
No Biography provided

Comments and Discussions

-- There are no messages in this forum --
Posted 15 Feb 2015

Tagged as


4 bookmarked