Setting up LinqToXSD in Visual Studio 2012

28. maart 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 7-9-2013 12:26:54 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 7-9-2013 19:40:46 United States #
on the main page

Very interesting subject, thanks for posting.

Craig Kourkoumellis 10-9-2013 15:01:47 United States #
Craig Kourkoumellis

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

Copper Earrings 29-10-2013 21:54:21 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 30-10-2013 07:05:46 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 2-11-2013 04:41:46 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 3-11-2013 05:50:28 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 3-11-2013 18:10:44 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 7-11-2013 13:55:43 United States #
Cole Fritchey

I love it.

RingPartner Pay Per Call Fraud 12-11-2013 02:38:21 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 12-11-2013 05:42:29 United States #
Meta Casadei

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

Eagle Safety Products 12-11-2013 08:12:30 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 18-11-2013 14:48:09 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 18-11-2013 15:10:27 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 20-11-2013 18:38:21 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 23-11-2013 02:21:08 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 25-11-2013 22:00:29 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 28-11-2013 06:39:41 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 28-11-2013 15:10:17 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 30-11-2013 03:30:43 United States #
his comment is here

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

he has a good point 1-12-2013 01:05:31 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 6-12-2013 06:17:05 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 6-12-2013 21:46:20 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 20-12-2013 02:19:28 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 27-12-2013 11:24:05 United States #
water dispenser

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

austin texas persaonl injury attorneys 1-1-2014 19:09:42 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 05:59:11 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 7-2-2014 02:42:43 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 7-2-2014 15:42:47 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 25-2-2014 13:38:29 United States #
Twyla

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

Carolann 1-3-2014 03:20:31 United States #
Carolann

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

Tesha 1-3-2014 21:47:48 United States #
Tesha

Useful stuff a joy to have found it

news 12-3-2014 08:23:30 United States #
news

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

discount The General 12-3-2014 09:36:29 #
discount The General

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

tootpaste 22-3-2014 10:11:56 United States #
tootpaste

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

Genna Buchheit 25-3-2014 17:41:28 United States #
Genna Buchheit

I could not resist commenting. Perfectly written!

how to get your penis big 4-4-2014 08:28:37 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 15-5-2014 22:49:44 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 11-6-2014 10:51:21 United States #
click to read

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

Kelley Sadhra 11-6-2014 17:08:58 United States #
Kelley Sadhra

PPPozdrowionkaa

Pantofi Barbatesti 18-6-2014 12:43:45 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 15-7-2014 08:37:36 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 2-4-2015 11:27:29 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 29-4-2015 04:30:17 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 15-5-2015 18:37:53 United States #
��C

Super site

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

merci pour cet article, hate de vous lire

zasilacz macbook 28-5-2015 07:17:17 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 20-6-2015 09:27:48 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 10-7-2015 19:03:59 United States #
Edris Holzerland

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

Arthur Mendia 10-7-2015 21:32:08 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 17-7-2015 16:09:15 United States #
 musica cloud free mp3 download sites

one mp3 download website for free

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

one mp3 download website for free

Counselling Dublin 21-7-2015 15:08:00 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 23-7-2015 12:04:59 United States #
townsville solar

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

look at this site 26-7-2015 02:36:42 United States #
look at this site

visit the up coming internet page 27-7-2015 08:19:01 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 29-7-2015 05:36:04 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 29-7-2015 19:54:36 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 31-7-2015 00:29:40 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 6-8-2015 04:02:24 United States #
bikini