Enabling intellisense for LINQ to SQL XML Mapping files by ThinqLinq

Enabling intellisense for LINQ to SQL XML Mapping files

A while back, I showed you how to use an XML Mapping file to enable POCO support with LINQ to SQL instead of requiring you to clutter your class libraries with LINQ to SQL attributes. It turns out, the schema for the XML Mapping files (xmlns="http://schemas.microsoft.com/linqtosql/mapping/2007") may not be included in your install of Visual Studio 2008. It was missing from mine. Luckily, the file is available on MSDN. If you add it to the schemas recognized by Visual Studio, you will get instant intellisense when editing your XML Mapping files. Here's how:

  1. Copy the schema from the Visual Studio 2008 Development Center available here.
  2. Paste it into a new XSD file and save it to your hard drive. If you want to stay consistent with the other schema files, locate your VS 2008 program directory and put it in the \Xml\Schemas directory. On my computer, this is located in the C:\Program Files\Microsoft Visual Studio 9.0\Xml\Schemas directory.
  3. In Visual Studio, Click on XML on the main menu and then select Schemas. This will open the XML Schemas editor window.
  4. Click the "Add..." button. Locate and select the XSD file that you saved in step 2.
  5. Double check that there is a check in the Use column for your newly added schema.

That's it. Now, the next time you're editing your XML Mapping files, you will get the intellisense goodness that Visual Studio has to offer.

Posted on - Comment
Categories: VB Dev Center - LINQ -
comments powered by Disqus