SWIDFromXSD 1.0.0

dotnet add package SWIDFromXSD --version 1.0.0                
NuGet\Install-Package SWIDFromXSD -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SWIDFromXSD" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SWIDFromXSD --version 1.0.0                
#r "nuget: SWIDFromXSD, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SWIDFromXSD as a Cake Addin
#addin nuget:?package=SWIDFromXSD&version=1.0.0

// Install SWIDFromXSD as a Cake Tool
#tool nuget:?package=SWIDFromXSD&version=1.0.0                

Procedures to generate the source files:

Gather source XSD files
Install LinqToXsdCore

This project uses LinqToXSDCore to generate the C# code files. dotnet tool install LinqToXsdCore -g

Create LinqToXsdCore namespace config files

These commands are run from the root directory of the project with the XSD files downloaded to .\xsd. linqtoxsd config -e .\xsd\iso-19770-2-schema-1.0.xsd .\xsd\swid-2015-extensions-1.0.xsd This will output LinqToXsdConfig.config

Change generated namespaces in LinqToXsdConfig.config
Change
    <Namespace DefaultVisibility="public" Schema="http://standards.iso.org/iso/19770/-2/2015/schema.xsd" Clr="standards.iso.org.iso.19770.2.2015.schema.xsd" />
    <Namespace DefaultVisibility="public" Schema="http://www.w3.org/2000/09/xmldsig#" Clr="www.w3.org.2000.09.xmldsig" />
    <Namespace DefaultVisibility="public" Schema="http://www.w3.org/XML/1998/namespace" Clr="www.w3.org.XML.1998.namespace" />
    <Namespace DefaultVisibility="public" Schema="http://csrc.nist.gov/ns/swid/2015-extensions/1.0" Clr="csrc.nist.gov.ns.swid.2015.extensions.1.0" />
To
    <Namespace DefaultVisibility="public" Schema="http://standards.iso.org/iso/19770/-2/2015/schema.xsd" Clr="org.iso.standards.swid" />
    <Namespace DefaultVisibility="public" Schema="http://www.w3.org/2000/09/xmldsig#" Clr="org.w3.ds" />
	<Namespace DefaultVisibility="public" Schema="http://www.w3.org/2001/XMLSchema" Clr="org.w3.xs" />
    <Namespace DefaultVisibility="public" Schema="http://www.w3.org/XML/1998/namespace" Clr="org.w3.xml" />
    <Namespace DefaultVisibility="public" Schema="http://csrc.nist.gov/ns/swid/2015-extensions/1.0" Clr="gov.nist.csrc.swid.extensions" />
Convert XSD to C#

linqtoxsd gen .\xsd\iso-19770-2-schema-1.0.xsd .\xsd\swid-2015-extensions-1.0.xsd -c .\LinqToXsdConfig.config -o .\src\

Convert Line endings of Files to Unix (LF)
Replace lang.TypeDefinition with null

There is a bug in either the schema or during conversion that results in iso-19770-2-schema-1.0.xsd.cs using a type that does not exist. There are two references to lang.TypeDefinition that need to be replaced with null.

Install XObjectsCore from Nuget
Useful library methods

SoftwareIdentity swid = SoftwareIdentity.Load("/path/to/swidtag"); byte[] bytes = Convert.FromHexString(string);

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 3,154 5/31/2022