Generate Typed Dataset from an XSD file in Visual Studio 2005

Visual Studio

Typed DataSets in ASP.NET is a pretty nice and handy feature. It gives you greater control of what the table relations should be and it pretty much reflect what the database holds. It’s pretty nice. But one thing I hate about Typed DataSet is that when you serialize your Typed DataSet your XML looks little messed up.

For the most part the XML serves the purpose but it has all sorts of primary key/foreign key references that are serialized into the XML that at times we might not need and might be confusing. Rather if we can get an XML that makes more sense and readable would suffice.

Adding an XSD file to your project won’t help right away as Visual Studio.NET 2005 doesn’t directly generate datasets (.Designer.cs files) out of it. But, there is a work around that you can use to make Visual Studio.NET 2005 generate typed-dataset from an XSD files. Here is what you should do,

  • Select the XSD file you want Visual Studio.NET 2005 to generate typed-dataset from
  • Right click and choose “Properties” to go into the XSD file’s Properties list
  • Set the “Build Action” to “Content”
  • Set the “Custom Tool” to point to “MSDataSetGenerator”

And that’s it. The next time you save the XSD file in Visual Studio.NET 2005 you should be able to see the dataset file, .Designer.cs (or .vb) file, that’s more meaningful to read.

Related Posts with Thumbnails


Subscribe to our free RSS feed to keep up with what's happening at DemoGeek.com

At DemoGeek.com we try to explain the tech stuffs in as much detail as we can to help the not-so-tech-savvy of our friends understand and follow the tech stuffs.

Share/Save/Bookmark

Subscribe to DemoGeek.com

No comments yet

Leave a Reply





XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

About DemoGeek.com

DemoGeek.com brings you high quality articles, tutorials and how to's on everything related to Microsoft Windows, Mac OSX, iPhone, Useful Websites, Browsers, Software and Programming.

At DemoGeek.com you'll find step-by-step explanation of the technical issues explained in detail with screenshots and screencasts. Read More...

Contact |  FUG |  Disclaimer

Creative Commons License

Canonical URL by SEO No Duplicate WordPress Plugin