After years of developing code using VS.NET IntelliSense feature its pretty painful to write CAML (Collaborative Application Markup Language) in XML files where IntelliSense is not available by default.
However now there is a workaround to get IntelliSense for CAML by linking it to the right XSD file. Even better John Holliday recently released a free tool CAML.NET to solve this problem and provides additional features.
Option 1: Fix IntelliSense by creating a reference to wss.xsd
This solution will load the XSD whenever a new XML file referencing it is opened.
Open the Catalog.xml file from the VS.NET installation folder. If you are using VS.NET 2008 Catalog.xml will be available in C:\Program Files\Microsoft Visual Studio 9.0\Xml\Schemas.
To create a new reference to wss.xsd, copy and paste the code below:
<Schema href="C:/Program Files/Common Files/Microsoft Shared/Web Server Extensions/12/TEMPLATE/XML/wss.xsd"
Restart your Visual Studio.NET instance and and you will have IntelliSense available when working with CAML files.
Option 2: Install John Holliday’s CAML.NET IntelliSense tool
I am using this tool from last 3 weeks and finding it very useful when editing CAML files. It provide more extensive IntelliSense than you get with reference the wss.xsd(Option 1).
CAML.NET IntelliSense tool extend the core schemas in two ways:
- Gather as much information as possible about each element and attribute and place it into xs:annotation elements so that it pops up in context while editing; and
- Identify and replace as many xs:string types as possible with enumerated types so the valid values for each attribute also popup in context while editing.
CAML.NET IntelliSense download package includes an MSI installer that copies the extended schemas into the local Visual Studio schema cache, so all you have to do is run the installer and then close and re-open Visual Studio. The current version handles both Visual Studio 2005 and 2008.