Setting up LinqToXSD in Visual Studio 2012

28. March 2013 20:29 by admin in .net, linqtoxsd, vs2012, linq

Intro


Linq To XSD is a code generation library for accessing xml in a strongly typed manner. Linq to XSD allows you to query and xml file like this:

Offcourse you need a XSD to define the structure of your xml but once you have that the API is much nicer than the general LinqToXML.

Setting it up in Visual Studio


Since it took me way too long and way too much googling to setup LinqToXSD in VS 2012 I thought I'd do 
a HOWTO setup for VS2012. So here's the step by step
  1. Download linqtoxsd from http://linqtoxsd.codeplex.com/ (I used 2.0.2.56002)
  2. Extract the zip to ($SolutionDir)\LinqToXSD
  3. Next unload the project in which you want use LinqToXSD (right click -> Unload Project) and edit the project file (right click->edit myproject.csproj)
  4. Now you have to reference the targets file in the LinqToXSD folder. At the top of the file insert the following line:

     <LinqToXsdBinDir Condition="'$(LinqToXsdBinDir)' == ''">$(SolutionDir)\LinqToXSD\</LinqToXsdBinDir>

    So it looks like this
    5. Finally at the bottom of the project file add   

        <Import Project="$(LinqToXsdBinDir)\LinqToXsd.targets" /> 

        below <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    6. Reload the project
    7. If all is well you can now change the build action of xsd files in your project like this:

         
    8. Once this is done code is generated which you should be able use immediately. Your xsd/xml has to obey certain restrictions. I included two sample files which should work out of the box here :
 
books.xsd (,92 KB)
books.xml (,93 KB)

Hope this is of some use and happy easter!
Elenor Konn 9/7/2013 12:26:54 PM United States #
Elenor Konn

I've learn some good stuff here. Certainly worth bookmarking for revisiting. I surprise how much attempt you place to create one of these fantastic informative web site.

on the main page 9/7/2013 7:40:46 PM United States #
on the main page

Very interesting subject, thanks for posting.

Craig Kourkoumellis 9/10/2013 3:01:47 PM United States #
Craig Kourkoumellis

thanks to the author representing intriguing his clock time proceeding this one.

Copper Earrings 10/29/2013 9:54:21 PM United States #
Copper Earrings

I've learned result-oriented points by way of your website. 1 other thing I want to say is newer laptop operating systems are inclined to allow far more memory to get used, but they likewise demand far more storage just to operate. If your computer could not handle a whole lot far more memory as properly as the newest application requires that ram increase, it usually could be the time to buy a new Laptop or computer. Thanks

Hammered Copper Earrings 10/30/2013 7:05:46 AM United States #
Hammered Copper Earrings

Someone necessarily assist to make critically articles I’d state. This really is the first time I frequented your web page and thus far? I amazed with the analysis you created to make this actual submit incredible. Exceptional activity!

Handmade Jewelry 11/2/2013 4:41:46 AM United States #
Handmade Jewelry

My partner and i nonetheless can not quite assume that I could be 1 of those reading through the essential recommendations located on this blog. My family and I are sincerely thankful for your generosity and for presenting me potential to pursue the chosen career path. Appreciate your sharing the essential info I acquired from your web-site.

Handmade Jewelry 11/3/2013 5:50:28 AM United States #
Handmade Jewelry

I genuinely thankful to uncover this internet site on bing, just what I was looking for : D too bookmarked .

Handmade Jewelry 11/3/2013 6:10:44 PM United States #
Handmade Jewelry

Not long noticed concerning your web website and are still already reading along. I assumed i’ll leave my initial comment. i do not verify what saying except that I’ve enjoyed reading. Nice weblog. ill be bookmarking keep visiting this internet website truly normally.

Cole Fritchey 11/7/2013 1:55:43 PM United States #
Cole Fritchey

I love it.

RingPartner Pay Per Call Fraud 11/12/2013 2:38:21 AM United States #
RingPartner Pay Per Call Fraud

WARNING: The RingPartner Pay Per Call Scam based out of Victoria, BC is under intense investigation. This pay per call operation has swindled advertisers, affiliates, investors and the public out of more than $580,000. Beware of the RingPartner Pay Per Call Fraud and be sure to warn others! This has been a Public Alert.

Meta Casadei 11/12/2013 5:42:29 AM United States #
Meta Casadei

This recipe was soo good, I've made it a few times since.

Eagle Safety Products 11/12/2013 8:12:30 AM United States #
Eagle Safety Products

I want to to take the time and express to you personally you have truly helped us by simply writing this amazing posts. I had been capable of use your own so handy information and put it to some good usage. I would really like to express our thankfulness and want to tell your audience they are so blessed to possess some one just like you creating wonderful content. I actually anticipate reading more valuable articles similar to this from you later on. Again, many thanks so much for your very helpful posting. We have added your rss as well as book marked you website within my social bookmarking site. Cheers!

RingPartner.com Scam 11/18/2013 2:48:09 PM United States #
RingPartner.com Scam

WARNING: The RingPartner Pay Per Call Scam based out of Victoria, BC is under intense investigation. This pay per call operation has swindled advertisers, affiliates, investors and the public out of more than $580,000. Beware of the RingPartner Pay Per Call Fraud and be sure to warn others! This has been a Public Alert.

RingPartner Fraud 11/18/2013 3:10:27 PM United States #
RingPartner Fraud

WARNING: The RingPartner Pay Per Call Scam based out of Victoria, BC is under intense investigation. This pay per call operation has swindled advertisers, affiliates, investors and the public out of more than $580,000. Beware of the RingPartner Pay Per Call Fraud and be sure to warn others! This has been a Public Alert.

Napoleon Scharler 11/20/2013 6:38:21 PM United States #
Napoleon Scharler

Spot on with this write-up, I truly think this website needs much more consideration. I�ll probably be again to read much more, thanks for that info.

RingPartner Pay Per Call Scam 11/23/2013 2:21:08 AM United States #
RingPartner Pay Per Call Scam

WARNING: The RingPartner Pay Per Call Scam based out of Victoria, BC is under intense investigation. This pay per call operation has swindled advertisers, affiliates, investors and the public out of more than $580,000. Beware of the RingPartner Pay Per Call Fraud and be sure to warn others! This has been a Public Alert.

RingPartner.com Scam 11/25/2013 10:00:29 PM United States #
RingPartner.com Scam

WARNING: The RingPartner Pay Per Call Scam based out of Victoria, BC is under intense investigation. This pay per call operation has swindled advertisers, affiliates, investors and the public out of more than $580,000. Beware of the RingPartner Pay Per Call Fraud and be sure to warn others! This has been a Public Alert.

Chadwicks promo codes 11/28/2013 6:39:41 AM United States #
Chadwicks promo codes

Usually I don't read post on blogs, however I wish to say that this write-up very compelled me to take a look at and do it! Your writing taste has been surprised me. Thanks, very great post.

Kareen 11/28/2013 3:10:17 PM United States #
Kareen

I used to be more than happy to search out this net-site.I needed to thanks in your time for this wonderful learn!! I positively enjoying each little little bit of it and I've you bookmarked to check out new stuff you blog post.

his comment is here 11/30/2013 3:30:43 AM United States #
his comment is here

I always was interested in this subject and still am, regards for posting.

he has a good point 12/1/2013 1:05:31 AM United States #
he has a good point

I've recently started a website, the information you provide on this site has helped me tremendously. Thanks for all of your time & work. "Show me the man who keeps his house in hand, He's fit for public authority." by Sophocles.

call from Santa 12/6/2013 6:17:05 AM United States #
call from Santa

Hi! Do you know if they make any plugins to help with Search Engine Optimization? I'm trying to get my blog to rank for some targeted keywords but I'm not seeing very good success. If you know of any please share. Kudos!

Santa letters 12/6/2013 9:46:20 PM United States #
Santa letters

I am really enjoying the theme/design of your site. Do you ever run into any internet browser compatibility problems? A few of my blog readers have complained about my blog not working correctly in Explorer but looks great in Firefox. Do you have any recommendations to help fix this problem?

Claude 12/20/2013 2:19:28 AM United States #
Claude

Normally I don't read post on blogs, but I wish to say that this write-up very forced me to check out and do so! Your writing style has been surprised me. Thanks, quite great post.

water dispenser 12/27/2013 11:24:05 AM United States #
water dispenser

nice. i like what you had written and will update more

austin texas persaonl injury attorneys 1/1/2014 7:09:42 PM United States #
austin texas persaonl injury attorneys

breakfast coming more than once more to read through further information. Great products from you, man. I've realize your things prior to and you happen to be just

sneak a peek at these guys 2/2/2014 5:59:11 AM United States #
sneak a peek at these guys

Simply wanna remark on few general things, The website style and design is perfect, the subject matter is really superb. "By following the concept of 'one country, two systems,' you don't swallow me up nor I you." by Deng Xiaoping.

Willena 2/7/2014 2:42:43 AM United States #
Willena

I am sure everyone that has come to your website has appreciated it as much as me, keep up th good informative work.

brazilian stadiums for 2014 world cup 2/7/2014 3:42:47 PM United States #
brazilian stadiums for 2014 world cup

Interesting post! Unless you already do it you really should think about posting the articles to shetoldme - My guess is the people on that website will appreciate the articles; and it might get you more traffic. Rgds, Lan Murrie from Donggang

Twyla 2/25/2014 1:38:29 PM United States #
Twyla

Finding your post was beneficial for me, thanks a lot.

Carolann 3/1/2014 3:20:31 AM United States #
Carolann

I was researching came across your post, and am glad I did, thanks

Tesha 3/1/2014 9:47:48 PM United States #
Tesha

Useful stuff a joy to have found it

news 3/12/2014 8:23:30 AM United States #
news

I am not rattling fantastic with English but I line up this real easy to translate.

discount The General 3/12/2014 9:36:29 AM #
discount The General

[url=http://www.softassembly.com/The-General.html]The General coupon[/url]. Lead your troops and capture the enemy flag!

tootpaste 3/22/2014 10:11:56 AM United States #
tootpaste

You details has been a terrific device for my research studies, Thanks.

Genna Buchheit 3/25/2014 5:41:28 PM United States #
Genna Buchheit

I could not resist commenting. Perfectly written!

how to get your penis big 4/4/2014 8:28:37 AM United States #
how to get your penis big

Thank you for some other informative site. The place else could I get that type of info written in such an ideal manner? I have a venture that I am just now operating on, and I've been on the look out for such info.

website 5/15/2014 10:49:44 PM United States #
website

Some really nice and useful info on this site, too I believe the design and style has good features.

click to read 6/11/2014 10:51:21 AM United States #
click to read

I always was interested in this topic and still am, thank you for posting.

Kelley Sadhra 6/11/2014 5:08:58 PM United States #
Kelley Sadhra

PPPozdrowionkaa

Pantofi Barbatesti 6/18/2014 12:43:45 PM United States #
Pantofi Barbatesti

Due to the fact I at first wrote with regards to MBT footwear at <strong><a href="incaltaminte-mopiel.ro/.../category&path=18_46"; title="Pantofi Barbatesti">Pantofi Barbatesti</a></strong>, a whole lot contains modified over the brand name, and the inventor and founder consists of remaining the small business. Involving true potential buyers, evaluations of MBT footwear are rather merged. If your self're thinking of a couple of MBT sneakers, I strongly persuade by yourself in direction of additionally go through the feedback remaining within just reply towards the after posts, and speak in the direction of your medical doctor just before sporting any design and style of shoe that is therefore considerably substitute in opposition to what oneself're utilised in the direction of, or in the direction of address any fashion of agony or situation.

Lptopy tanie 7/15/2014 8:37:36 AM United States #
Lptopy tanie

I'm extremely impressed with your writing skills and also with the layout on your weblog. Is this a paid theme or did you modify it yourself? Anyway keep up the nice quality writing, it�s rare to see a nice blog like this one today..

Lilliam Gedris 4/2/2015 11:27:29 AM United States #
Lilliam Gedris

Fantastic website you have here but I was wanting to know if you knew of any forums that cover the same topics discussed in this article? I'd really like to be a part of community where I can get feedback from other knowledgeable individuals that share the same interest. If you have any suggestions, please let me know. Thanks a lot!

Dropbox Tips Tricks 4/29/2015 4:30:17 AM United States #
Dropbox Tips Tricks

That is a good tip particularly to those fresh to the blogosphere. Brief but very precise information� Thanks for sharing this one. A must read post!

��C 5/15/2015 6:37:53 PM United States #
��C

Super site

��C 5/16/2015 11:33:09 AM United States #
��C

merci pour cet article, hate de vous lire

zasilacz macbook 5/28/2015 7:17:17 AM United States #
zasilacz macbook

<p>Excellent blog you have got here.. It’s hard to find high quality writing like yours nowadays. I truly appreciate people like you! Take care!!</p>

Marchelle Gottschalk 6/20/2015 9:27:48 AM United States #
Marchelle Gottschalk

Hi, I’m a 20 year old girl and I live in USA. I’ve decided to make this profile to make new friends and meet people who like dogs and cats. I’d like to chat a lot with different people, share a photo of your beloved animal and have some fun ;) Anyway, if you are interested in knowing and seeing more pics of them. You can view the link below: http://goo.gl/4W29pZ

Edris Holzerland 7/10/2015 7:03:59 PM United States #
Edris Holzerland

Constantly be on the lookout for new patterns to enhance your gaming encounter.

Arthur Mendia 7/10/2015 9:32:08 PM United States #
Arthur Mendia

Convenience is the trick. Nothing obstructs a marathon gaming session quicker than a cramped hand.

musica cloud free mp3 download sites 7/17/2015 4:09:15 PM United States #
 musica cloud free mp3 download sites

one mp3 download website for free

free mp3 download 7/18/2015 10:36:11 AM United States #
free mp3 download

one mp3 download website for free

Counselling Dublin 7/21/2015 3:08:00 PM United States #
Counselling Dublin

Wow, This paragraph exactly the content i've truly been hunting for, I could not resist commenting. Well written! Saved as a favorite, I love your blog!.

townsville solar 7/23/2015 12:04:59 PM United States #
townsville solar

How do I copyright articles and newsletters that I am wanting to publish?

look at this site 7/26/2015 2:36:42 AM United States #
look at this site

visit the up coming internet page 7/27/2015 8:19:01 AM United States #
visit the up coming internet page

I've read not one particular article on your weblog. You are a major lad

agua bendita tasco 7/29/2015 5:36:04 AM United States #
agua bendita tasco

I really like your writing style, wonderful info, thank you for putting up Laughing. "He wrapped himself in quotations- as a beggar would enfold himself in the purple of Emperors." by Rudyard Kipling.

Anxiety Counselling Dublin 7/29/2015 7:54:36 PM United States #
Anxiety Counselling Dublin

Wow, This post its just what I've been browsing for, I couldn't refrain from commenting. Exceptionally well written! Saved as a favorite, I really like your website!.

anger management counselling dublin 7/31/2015 12:29:40 AM United States #
anger management counselling dublin

incredible post precisely the content I've been browsing for, I couldn't refrain from commenting. Perfectly written! Saved as a favorite, I like your blog!.

bikini 8/6/2015 4:02:24 AM United States #
bikini