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.
To get this going here is what I did.
- Open the XML file you want to work on E.g. your Onet.xml file
- Add xmlns:"http://schemas.microsoft.com/sharepoint" declaration in the root node E.g: <Project xmlns:"http://schemas.microsoft.com/sharepoint" ... >
- 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):
- With your XML document open press F4 to bring up the properties pane
- Click the ellipsis next to the "Schemas" property
- Click the Add button down at the bottom of the XSD Schemas dialogue
- Navigate to c:\program files\common files\microsoft shared\web server extensions\12\TEMPLATE\XML
- Highlight all the XSD files
- Click Open
- 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!