There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global LinqToXsdCore --version
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest # if you are setting up this repo
dotnet tool install --local LinqToXsdCore --version
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=LinqToXsdCore&version=
nuke :add-package LinqToXsdCore --version


This project forms the command-line interface utility used to generate C# code that represents the structure of an XML document that conforms to an W3C XML Schema (XSD).

Most of the logic for reading an XSD is coded in the XObjectsCore project, but logic that is specific to an individual XSD (like custom types and elements), is generated as C# code using the CodeDOM provider (also inside XObjectsCore) that is invoked via this CLI tool.

The code this tool generates has a dependency on namespaces defined in the XObjectsCore library. You can add a reference to that library via nuget here:

Don't add this project as a dependency to your shipping libraries or app - depend on the code it generates, and the XObjectsCore library instead.

This project adds additional features from the old CLI tool (the XObjectsGenerator project is the legacy CLI), like generating .config files with default values from an existing XSD and generating code from multiple XSD's and multiple .config files.


This tool is published as a global .NET tool here: Install it using

dotnet tool install LinqToXsdCore -g

After that, you can use the tool globally via the command 'LinqToXsd' at a console (cmd or powershell).

Using LinqToXsd to generate code

Before generating code, create an example configuration file from your XSD (this will allow you to customize how XML namespaces map to .NET CLR namepsaces).

linqtoxsd config -e wss.xsd

Currently, as this is a port of the LinqToXsd project, some configuration elements are not documented but for some reason or another are processed and interpreted in source code. But the gist of what you need as a developer is to pay attention to the <Namespaces /> element.

Under that element, it will create default namepsace mappings similar to the following example:

  <Namespace Schema="" Clr="" />

The XML namespace becomes: in the generated C# code. And obviously now that you have a configuration file you can change the default values to something more suitable for you.

To use your new configuraton file to generate code:

linqtoxsd gen wss.xsd -c .\wss.xsd.config

It will output code to 'file.xsd.cs', or in this case 'wss.xsd.cs'.

Regenerating code

You can also add a pre-build event in your Visual Studio project definition, invoking the linqtoxsd tool to regenerate code every time you build your solution:

linqtoxsd gen "$(ProjectDir)wss.xsd" -c "$(ProjectDir)wss.xsd.config"

In the above example, the strings beginning with $() are MSBuild macros.

Help for other functions

There's some other miscellaneous functions in the CLI tool that may be helpful to you, and be used to exert finer control over code output. To view the help screen for this tool:

linqtoxsd help

To view help for a specific verb:

linqtoxsd <verb> --help

To view help on configuration file generation:

linqtoxsd config --help

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.1 is compatible.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last updated
3.4.6 2,297 2/13/2024
3.4.5 180 2/6/2024
3.4.4 196 1/29/2024
3.4.3 169 1/24/2024
3.4.2 563 10/2/2023
3.4.1 244 9/16/2023
3.4.0 343 7/3/2023
3.3.3 578 1/6/2023
3.3.2 805 3/30/2022
3.3.1 420 3/29/2022
3.3.0 482 3/28/2022
3.2.1 1,001 7/3/2021
3.2.0 500 2/15/2021
3.1.0 718 5/3/2020
3.0.1 638 3/15/2020 478 3/11/2020 534 3/5/2020 572 2/14/2020 546 1/18/2020 590 10/27/2019 624 10/1/2019 589 9/27/2019 573 8/20/2019 623 6/7/2019 403 5/15/2019