a·gen·tic a·gil·i·ty

LINQ to XSD

TL;DR; Explains how to use LINQ to XSD in C# to generate classes from XSD files, including setup steps, project configuration, and integration with MSBuild.

Published on
1 minute read
Image
https://nkdagility.com/resources/6v73sdkKVTr
Subscribe

Absolutely brilliant. That’s what I think of Linq to XSD. Disappointed that is only works in C#, but having to use C# for a single project out of a solution it is a small price to pay to get the functionality.

If you install the LINQ to XSD Preview Alpha 0.2 Refresh you get a couple of extra project definitions:

LINQ to XSD

If you create one of these it will have the features enabled. You can add the features to an existing project by editing the project definition file to add a property group:

1   1: <PropertyGroup>
1   2:   <TXLINQBinDir Condition="'$(TXLINQBinDir)' == ''">$(ProgramFiles)LINQ to XSD PreviewBin</TXLINQBinDir>
1   3: </PropertyGroup>

And an import reference:

1   1: <Import Project="$(TXLINQBinDir)LinqToXsd.targets" />

note: if you are using MSBuild or Team Build you will need to install this add on there as well….

Now that you have a project, when you add an XSD you will have extra Build Actions available. Once you have set all of your XSD files to this Action and build, you will have classes for all of your XSD’s. On down side is that it created a single file ("/obj/debug/LinqToXsdSource.cs"), bit it does work.

Technorati Tags: .NET   TFBS

Subscribe

Connect with Martin Hinshelwood

If you've made it this far, it's worth connecting with our principal consultant and coach, Martin Hinshelwood, for a 30-minute 'ask me anything' call.

Our Happy Clients​

We partner with businesses across diverse industries, including finance, insurance, healthcare, pharmaceuticals, technology, engineering, transportation, hospitality, entertainment, legal, government, and military sectors.​

CR2

Illumina Logo

Illumina

Slicedbread Logo

Slicedbread

Boeing Logo

Boeing

Lockheed Martin Logo

Lockheed Martin

Cognizant Microsoft Business Group (MBG) Logo

Cognizant Microsoft Business Group (MBG)

Epic Games Logo

Epic Games

SuperControl Logo

SuperControl

Teleplan Logo

Teleplan

Capita Secure Information Solutions Ltd Logo

Capita Secure Information Solutions Ltd

Deliotte Logo

Deliotte

Freadom Logo

Freadom

New Signature Logo

New Signature

ALS Life Sciences Logo

ALS Life Sciences

Genus Breeding Ltd Logo

Genus Breeding Ltd

MacDonald Humfrey (Automation) Ltd. Logo

MacDonald Humfrey (Automation) Ltd.

Xceptor - Process and Data Automation Logo

Xceptor - Process and Data Automation

Bistech Logo

Bistech

New Hampshire Supreme Court Logo

New Hampshire Supreme Court

Department of Work and Pensions (UK) Logo

Department of Work and Pensions (UK)

Washington Department of Transport Logo

Washington Department of Transport

Nottingham County Council Logo

Nottingham County Council

Ghana Police Service Logo

Ghana Police Service

Royal Air Force Logo

Royal Air Force

MacDonald Humfrey (Automation) Ltd. Logo

MacDonald Humfrey (Automation) Ltd.

Workday Logo

Workday

Cognizant Microsoft Business Group (MBG) Logo

Cognizant Microsoft Business Group (MBG)

Trayport Logo

Trayport

ALS Life Sciences Logo

ALS Life Sciences

Deliotte Logo

Deliotte