Share via


Using SharePoint XSDs in Visual Studio

One of the things that made SharePoint developers lose sleep and hair over was the lack of intellisense support when working with the products XML files.

In WSS V3 and MOSS we will ship the corresponding XSDs. This is great news because you can use those XSDs to validate your XML files to make sure they are correctly formed etc...

Another nice side effect this has is the ability for Visual Studio to use these XSDs to provide you intellisense support when working on these files.

E.g:

To get this going here is what I did.

  1. Open the XML file you want to work on E.g. your Onet.xml file
  2. Add xmlns:"https://schemas.microsoft.com/sharepoint" declaration in the root node E.g: <Project xmlns:"https://schemas.microsoft.com/sharepoint" ... >
  3. Then you need to instruct Visual Studio where to find the XSDs that define the schema for that namespace. To do this (Visual Studio 2005):
    1. With your XML document open press F4 to bring up the properties pane
    2. Click the ellipsis next to the "Schemas" property
    3. Click the Add button down at the bottom of the XSD Schemas dialogue
    4. Navigate to c:\program files\common files\microsoft shared\web server extensions\12\TEMPLATE\XML
    5. Highlight all the XSD files
    6. Click Open
    7. Click OK

You should now have intellisense working!

There might be other ways of doing this, but this is one method i have found to work for me. If anyone has another way they do it please comment!

-Chris.

Comments