How to add a custom intellisense and validation schema to Visual Web Developer 2005

Let’s imagine that you want to add Internet Explorer 7 schema. Here what you need to do

1. Copy Program Files\VS8\Common7\Packages\Schemas\HTML\ie6_0.xsd to ie7_0.xsd.

2. Open ie7_0.xsd in VS XML editor: (File | Open | click small arrow on the Open button,

choose XML Editor) or any other text editor.

3. In the root xsd:schema element change namespace URI from IE6 to IE7, CSS schema to CSS 2.1 and change friendly name to Internet Explorer 7:

<xsd:schema version=”1.0″
 vs:cssschema=”CSS 2.1
 vs:SuccinctFriendlyName=”Internet Explorer 7“>

You can leave reference to to DOM (vs:clientom attribute) unchanged as we are not changing anything in the DOM (which drive client script intellisense) at this time. If you are interested in how to change the DOM, have a look at my earlier blog posts: Part 1 and Part 2.

4. Save the file and exit Visual Studio.

5. Create a registry script to add your schema to the list of the HTML editor validation and intellisense schemas.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Packages\{1B437D20-F8FE-11D2-A6AE-00104BCC7269}\Schemas\Schema 21]
“Friendly Name”=”Internet Explorer 7.0”

Note that here I hardcoded Schema 21 since I know that Whidbey comes with 20 schemas. You may want to check if that is true on your machine: some add-ins may install extra schemas. There should not be any gaps in numbering or your new schema won’t be loaded.

7. Run the registry script (you will need admin rights), start VS, create a new HTML page and observer new schema appear in the target schema dropdown on the HTML editor toolbar.

You may ask what are those 20 schemas are for and why there are only 7 visible in the target browser dropdown. The reason is that some schemas only apply to certain file types. For example, there is a schema for Global.asax and since this and only this schema applies to this file type, the schema does not have a friendly name and does not appear in the target schema dropdown. In fact, when you open Global.asax, you’ll see that target schema dropdown is disabled. The relationship between Global.asax and its schema are hardcoded. Some other schemas are ‘companion’ schemas. For instance, intellisense and validation on a typical Web Form file (aspx) uses target browser schema, server directives schema as well as schemas dynamically generated from server controls.

Note that in VS 2003 we were picking up all schemas in the schema folder as well as all schemas included in the project. For performance reasons we are no longer sniffing files on VS startup and are no longer monitoring file changes on disk. Therefore, all schemas must appear in the registry and when you are adding a a new schema or changing an existing one, you have restart the IDE.

Comments (12)

  1. Trackback from

  2. Orion says:

    Cool tip! I’m trying to track down more documentation on how VS 2005 handles Intellisense XSD’s…so most of what I’ve come across is for VS 2003. Specifically, I’m wondering if there’s a way to troubleshoot my XSD or something that explains how VS parses it. (I’m getting validation errors on code that *should* be valid.) Any suggestions?

    – Orion

  3. VS 2005 parses intellisense schema XSD close to what VS 2003 did. What kind of errors are you getting?

  4. I’ve posted another new DevNugget to Channel 9. This one focuses on the schema-driven Intellisense and…

  5. In this DevNugget, .net Developer Evangelist G. Andrew Duthie (aka .net DEvHammer), shows you how you…

  6. A few months ago I was working on a project that required the creation of full schemas for the configuration

  7. Anonymous says:

    One cool new feature available in Visual Studio 2005 is the ability to take advantage of Intellisense statement completion in the Source view of an ASP.NET Web Form. In addition, Visual Studio 2005 provides validation of your markup.

  8. Whenever I start a new web project, one of the first things I do is create a "Base" class for all my…