SWIDFromXSD 1.0.0
dotnet add package SWIDFromXSD --version 1.0.0
NuGet\Install-Package SWIDFromXSD -Version 1.0.0
<PackageReference Include="SWIDFromXSD" Version="1.0.0" />
paket add SWIDFromXSD --version 1.0.0
#r "nuget: SWIDFromXSD, 1.0.0"
// 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
- Create a folder
xsd
in the root directory of the project. - Download these files to that xsd directory
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);
Useful links
- Newer versions of XSD files may be listed here: https://csrc.nist.gov/Projects/Software-Identification-SWID/resources
- NIST SWID tools available here: https://github.com/usnistgov/swid-tools
Product | Versions 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. |
-
net6.0
- XObjectsCore (>= 3.3.0)
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,092 | 5/31/2022 |