DemaConsulting.SpdxModel
2.6.0
Prefix Reserved
dotnet add package DemaConsulting.SpdxModel --version 2.6.0
NuGet\Install-Package DemaConsulting.SpdxModel -Version 2.6.0
<PackageReference Include="DemaConsulting.SpdxModel" Version="2.6.0" />
<PackageVersion Include="DemaConsulting.SpdxModel" Version="2.6.0" />
<PackageReference Include="DemaConsulting.SpdxModel" />
paket add DemaConsulting.SpdxModel --version 2.6.0
#r "nuget: DemaConsulting.SpdxModel, 2.6.0"
#:package DemaConsulting.SpdxModel@2.6.0
#addin nuget:?package=DemaConsulting.SpdxModel&version=2.6.0
#tool nuget:?package=DemaConsulting.SpdxModel&version=2.6.0
SPDX Model
A modern C# library for working with SPDX (Software Package Data Exchange) documents. This library provides a comprehensive in-memory model for reading, manipulating, and writing SPDX Software Bill of Materials (SBOM) files.
Features
- ๐ Full SPDX 2.2 and 2.3 Support - Complete implementation of SPDX specifications
- ๐ฆ In-Memory Model - Efficient object model for SPDX documents
- ๐ JSON Serialization - Read and write SPDX documents in JSON format
- ๐ฏ Type-Safe - Strongly-typed C# API with nullable reference types
- ๐ Transform Support - Built-in utilities for manipulating SPDX relationships
- โก Multi-Target - Supports .NET 8, 9, and 10
- ๐ฅ๏ธ Multi-Platform - Builds and runs on Windows, Linux, and macOS
- ๐งช Well-Tested - Comprehensive test suite with high code coverage
- ๐ Well-Documented - XML documentation for all public APIs
- ๐ Continuous Compliance - Compliance evidence generated automatically on every CI run, following the Continuous Compliance methodology
Installation
Install the package via NuGet:
dotnet add package DemaConsulting.SpdxModel
Or via the Package Manager Console:
Install-Package DemaConsulting.SpdxModel
Quick Start
Reading an SPDX Document
using DemaConsulting.SpdxModel;
using DemaConsulting.SpdxModel.IO;
// Read SPDX document from JSON
var json = File.ReadAllText("sbom.spdx.json");
var document = Spdx2JsonDeserializer.Deserialize(json);
// Access document properties
Console.WriteLine($"Document: {document.Name}");
Console.WriteLine($"Version: {document.Version}");
Console.WriteLine($"Packages: {document.Packages.Length}");
Creating an SPDX Document
using DemaConsulting.SpdxModel;
using DemaConsulting.SpdxModel.IO;
// Create a new SPDX document
var document = new SpdxDocument
{
Id = "SPDXRef-DOCUMENT",
Name = "My Software",
Version = "SPDX-2.3",
DocumentNamespace = "https://example.com/my-software",
CreationInformation = new SpdxCreationInformation
{
Created = DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ssZ"),
Creators = ["Tool: MyTool-1.0"]
},
Packages =
[
new SpdxPackage
{
Id = "SPDXRef-Package",
Name = "MyPackage",
Version = "1.0.0",
DownloadLocation = "https://example.com/package",
FilesAnalyzed = false,
LicenseConcluded = "MIT",
LicenseDeclared = "MIT",
CopyrightText = "Copyright (c) 2024 Example Corp"
}
]
};
// Serialize to JSON
var json = Spdx2JsonSerializer.Serialize(document);
File.WriteAllText("output.spdx.json", json);
Working with Relationships
using DemaConsulting.SpdxModel;
using DemaConsulting.SpdxModel.Transform;
// Add relationships to a document
var relationship = new SpdxRelationship
{
Id = "SPDXRef-DOCUMENT",
RelationshipType = SpdxRelationshipType.Describes,
RelatedSpdxElement = "SPDXRef-Package"
};
SpdxRelationships.Add(document, relationship);
// Get root packages from a document
var rootPackages = document.GetRootPackages();
API Overview
Core Classes
SpdxDocument- Represents an SPDX documentSpdxPackage- Represents a software packageSpdxFile- Represents a fileSpdxSnippet- Represents a code snippetSpdxRelationship- Represents relationships between elementsSpdxCreationInformation- Document creation metadata
Serialization
Spdx2JsonSerializer- Serialize SPDX documents to JSONSpdx2JsonDeserializer- Deserialize SPDX documents from JSON
Transforms
SpdxRelationships- Utilities for managing relationships
Documentation
- API Documentation - Detailed API reference
- Contributing Guide - How to contribute to the project
- Code of Conduct - Community guidelines
- Security Policy - Security vulnerability reporting
- AGENTS.md - Instructions for AI coding agents
Requirements
- .NET 8.0, 9.0, or 10.0
- C# 12 or later
Development
Building from Source
# Clone the repository
git clone https://github.com/demaconsulting/SpdxModel.git
cd SpdxModel
# Restore tools
dotnet tool restore
# Build
dotnet build
# Run tests
dotnet test
Running Tests with Coverage
dotnet test --collect:"XPlat Code Coverage;Format=opencover"
Contributing
We welcome contributions! Please see our Contributing Guide for details on:
- Setting up your development environment
- Coding standards and guidelines
- Submitting pull requests
- Reporting bugs and requesting features
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
- ๐ซ Issues: GitHub Issues
- ๐ฌ Discussions: GitHub Discussions
Related Projects
- SPDX Specification - Official SPDX specification
- spdx-tool - Command-line tool for working with SPDX documents
Acknowledgments
This project follows the SPDX specification maintained by the Linux Foundation.
Made with โค๏ธ by DEMA Consulting
| Product | Versions 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 is compatible. 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. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.Bcl.HashCode (>= 6.0.0)
- System.Text.Json (>= 10.0.5)
-
net10.0
- No dependencies.
-
net8.0
- System.Text.Json (>= 10.0.5)
-
net9.0
- System.Text.Json (>= 10.0.5)
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 |
|---|---|---|
| 2.6.0 | 223 | 4/3/2026 |
| 2.5.0 | 909 | 2/20/2026 |
| 2.4.0 | 812 | 12/15/2025 |
| 2.3.1 | 694 | 12/9/2025 |
| 2.3.0 | 324 | 12/4/2025 |
| 2.2.1 | 265 | 7/6/2025 |
| 2.2.0 | 203 | 7/6/2025 |
| 2.1.1 | 280 | 5/4/2025 |
| 2.1.0 | 365 | 10/9/2024 |
| 2.0.0 | 217 | 9/13/2024 |
| 1.4.0 | 246 | 7/29/2024 |
| 1.3.2 | 230 | 7/24/2024 |
| 1.3.1 | 234 | 7/22/2024 |
| 1.3.0 | 200 | 7/21/2024 |
| 1.2.0 | 199 | 7/15/2024 |
| 1.1.0 | 231 | 7/10/2024 |
| 1.0.0 | 195 | 6/29/2024 |
| 0.1.0-alpha.7 | 287 | 6/2/2024 |
| 0.1.0-alpha.6 | 157 | 6/2/2024 |
| 0.1.0-alpha.5 | 145 | 5/29/2024 |