戰地連結︰ Home My Flickr NBA.com About

2009年9月9日星期三

Associate XSD to XML file to enable IntelliSense

Overview

We .Net developers use IntelliSense extensively in our everyone work. I am happy using IntelliSense for XML files like web.config file. Then one day I come across a XML file with schema not available out-of-the-box from VS (think about NHibernate hbm files). How can I use IntelliSense with it?

Reference

XML Schemas dialog in Visual Studio 2008

Steps

To use schema(s) for a XML file

  1. Open a XML file in Visual Studio 2008
  2. In menu bar, select "XML" => "Schemas…"
  3. In the "XML Schemas" windows, select "Use this Schema" in the "Use" column next to your desired schema
  4. Click OK, done!

The "XML Schemas" windows will search for schema files (.XSD) in your project or in folder %VS 2008 install folder%\xml\Schemas. You can also manually add schemas files using the "Add…" button

沒有留言: