
126
|
Chapter 4, Customizing Visual Studio
#32 Enable IntelliSense for HTML and XML Documents
HACK
Considerations for Custom Controls
Creating schema for a custom control often involves extending the existing
schema of one of ASP.NET’s built-in controls. In this situation, we can elim-
inate a lot of typing and create a more useful schema by copying the appro-
priate portions of the default ASP.NET schema. After creating your schema
file, locate and open the file <VS Install Directory>\Common7\Packages\
schemas\xml\asp.xsd. This file contains the schema for all the built-in con-
trols. Find and copy into your new schema the appropriate
attributeGroup
elements that apply to your control.
Editing the asp.xsd is a bad idea. Not only are you poten-
tially breaking IntelliSense for the built-in controls, but the
next time you upgrade or patch Visual Studio, your changes
will probably be lost.
In most cases, you will be able to use the ControlAttributes group even if no
other groups apply. After pasting these definitions into your schema, you
can simply reference them with an attribute group tag inside the appropri-
ate type:
<xsd:attributeGroup ref="ControlAttributes" />
After that, your type will automatically provide all the attributes defined in
the referenced attribute group.
Installing the Schema
After you have created the schema, you need to place it where Visual Studio
expects to find it. The normal