| layout | default |
|---|
How to build, test, pack, and publish every component of the repository.
- .NET SDK 8.0 or later (the solution targets
net8.0,net9.0, andnet10.0; the SDK'srollForwardis set tolatestMajorwith prereleases allowed). - Works on Windows, Linux, and macOS.
- No native toolchains are required — the library is 100% managed.
CSharp_CHDSharp.sln
├── CHDSharpLib/ The library (NuGet package: CHDSharp)
├── CHDSharpCli/ Command-line CHD manager (binary: CHDSharp)
├── CHDSharpLib/Encoder/ Encoder subsystem (V5 CHD creation; see [Encoder](encoder.md))
├── CHDSharpTest/ xUnit unit + corpus tests
├── CHDSharpTestDataGeneration/ Deterministic corpus generator
├── CHDSharpTester/ WPF interactive tester
├── CHDSharpEncoderTest/ xUnit encoder tests (455 tests)
├── CHDSharpBattleTest/ Battle test harness (chdman vs CHDSharp)
├── VendoredZLib/ Pure C# zlib port
├── VendoredLZMA/ LZMA SDK C# port
├── VendoredFlac/ Pure C# FLAC encoder/decoder
├── VendoredZSTD/ Pure C# zstd 1.5.5 encoder/decoder (MAME parity)
└── Directory.Build.props Centralized versioning (1.6.0) and analyzer setup
# Everything (Debug)
dotnet build
# Release
dotnet build -c Release
# A single project
dotnet build CHDSharpLib/CHDSharpLib.csproj -c ReleaseDirectory.Build.props defines a single <Version> (currently 1.6.0) that all projects inherit, so AssemblyVersion, FileVersion, and the NuGet package version stay in sync automatically.
All projects enable:
Nullable+ImplicitUsings.LangVersion 14.- Meziantou.Analyzer (build-time analyzer,
PrivateAssets=all). CHDSharpLibadditionally treats missing XML documentation (CS1591) as an error, so all public API members must carry XML doc comments.
The solution is kept free of ReSharper warnings and errors. The gate runs InspectCode from
the JetBrains command-line tools
(jb), from the repository root:
jb inspectcode CSharp_CHDSharp.sln --severity=WARNING --output=inspectcode.xmlThe inspection policy lives in the root .editorconfig:
- The vendored codecs are exempt.
VendoredZLib,VendoredLZMA,VendoredFlacandVendoredZSTDare third-party ports checked in verbatim; byte-for-bytechdmanparity depends on them staying untouched, so their style/quality inspections (redundant code, unreachable branches, naming, …) are disabled there. Never "fix" a finding inside those folders — exempt it in.editorconfiginstead. - Consumer-facing models are exempt from "never used" inspections. Public library records
(
CHDSharpLib/Models), the JSON corpus manifest (CHDSharpTestDataGeneration/Models) and the WPF data models (CHDSharpTester/Models) expose members that are only read by callers, serializers or XAML bindings.
InspectCode 2026.2 logs internal
AssertionExceptions while its nullable-flow analyzer walks the vendored ZSTD sources. This is a bug in the analyzer, not a finding: the report is still empty. Add--exclude="Vendored*/**/*.cs"if you want a silent console.
# Run the full suite (all target frameworks)
dotnet test
# A single framework
dotnet test -f net10.0
# A specific test class
dotnet test --filter "FullyQualifiedName~CorpusTests"
# Verbose console output
dotnet test -v detailedThe suite contains 4,216 tests per target framework (unit + corpus) that run against 30 deterministic CHD fixtures covering V1–V5 and every codec. See Testing.
The companion encoder suite (CHDSharpEncoderTest, 455 tests) validates CHD creation against chdman.exe — including 100 MB+ raw/CD round-trips:
dotnet test CHDSharpEncoderTest/ --filter "FullyQualifiedName~LargeFileValidationTests"Regenerating the corpus requires the vintage
chdman/hdcompbinaries inCHDSharpTest/chdman/:dotnet run --project CHDSharpTestDataGenerationThe generator is deterministic: regenerating produces byte-identical fixtures.
The battle harness (CHDSharpBattleTest) cross-checks the decoder and encoder against
chdman.exe (3,174/3,174 checks on the deterministic corpus; 3003/3003 on a real-world
scan of 56 CHDs), and can also scan any real-world CHD
folders via --real <dir>:
dotnet run --project CHDSharpBattleTest # repo-root chdman.exe auto-resolved
dotnet run --project CHDSharpBattleTest -- --real "D:\CHD Collection"dotnet pack CHDSharpLib/CHDSharpLib.csproj -c ReleaseThe package (CHDSharp.<version>.nupkg) is written to CHDSharpLib/bin/Release/. It includes:
- The library DLL for
net8.0,net9.0, andnet10.0. - The README (this wiki's sibling pages are referenced from it), the combined license file (
LICENSE.txt), and the package icon. - Embedded PDBs (
DebugType=embedded) and embedded SourceLink for debugging. - Deterministic, reproducible builds (
Deterministic=true,ContinuousIntegrationBuildon GitHub Actions).
| Package | Version | Purpose |
|---|---|---|
| Microsoft.Extensions.Logging.Abstractions | 10.0.13 (all TFMs) | Pluggable logging (optional) |
| System.IO.Hashing | 10.0.13 (all TFMs) | SHA1/MD5 hashing helpers |
| Microsoft.SourceLink.GitHub | 10.0.402 | SourceLink (build-time, PrivateAssets=all) |
All codec dependencies are vendored in-repo as project references and bundled inside the package (the only runtime NuGet dependency is the optional Microsoft.Extensions.Logging.Abstractions logging abstraction):
| Project | Purpose |
|---|---|
VendoredZLib |
Pure C# zlib (deflate/inflate) |
VendoredLZMA |
Pure C# LZMA SDK port |
VendoredFlac |
Pure C# FLAC encoder/decoder (based on CUETools.Flake) |
VendoredZSTD |
Pure C# zstd 1.5.5 encoder/decoder (C-to-C# port of MAME's bundled tree) |
CHDSharpLib also declares InternalsVisibleTo for CHDSharpTest, CHDSharpTestDataGeneration and CHDSharpEncoderTest so the test projects can exercise internal members directly.
# Build every release bundle (win/linux/osx x x64/arm64) into CHDSharpLib/bin/Release/
pwsh scripts/package-release.ps1
# One platform, custom output
pwsh scripts/package-release.ps1 -Rids win-x64 -OutputPath distFor every runtime identifier the script publishes the CLI as a framework-dependent
single-file binary (--self-contained false -p:PublishSingleFile=true — the .NET
runtime is not embedded), appends LICENSE.txt, README.md, README.txt and
WhatsNew.md, and writes CHDSharp_<rid>_v<version>.zip (the exact asset name the CLI's
built-in update check looks up on GitHub releases, e.g. CHDSharp_win-x64_v1.6.0.zip).
Existing files in the output path are never deleted. The binary is named CHDSharp
(CHDSharp.exe on Windows); bundles require the .NET 10 runtime.
The Release GitHub Actions workflow (.github/workflows/release.yml) runs this script
on a version tag, creates the GitHub release, pushes the NuGet package, and syncs the
wiki — see CI.
The repository is set up for GitHub Actions (ContinuousIntegrationBuild=true), producing deterministic builds and SourceLink-enabled symbols.
-
ci.yml- the build + test gatekeeper, on every push tomain, every pull request, and manual dispatch. TheCI gatejob aggregates:build & testacross Ubuntu, macOS and Windows: builds the full solution on Windows and the cross-platform subset elsewhere with-warnaserror(NuGet audit covers direct and transitive packages), then runs both xUnit suites (CHDSharpTest- 4,216 tests per target framework - andCHDSharpEncoderTest- 455 tests) for all three TFMs.quality:jb inspectcode --severity=WARNING, failing on any finding and uploading SARIF to code scanning.package:dotnet packplus a.nupkgcontent check, uploaded as an artifact.coverage: merged Cobertura coverage for both suites onnet10.0(the wall-clock parallel-encode test is excluded because instrumentation invalidates its timing).docs build: Jekyll build ofdocs/with--strict_front_matter.chdman parity (smoke): the quick battle harness against the checked-inCHDSharpTester/chdman.exe.Wiki & Pages(onmainonly, after the gate): syncsdocs/to the wiki and requests a Pages rebuild.
Test-spawned CLI runs are isolated from the production bug-report API via
CHDSHARP_NO_BUG_REPORTS=1/CHDSHARP_NO_TELEMETRY=1. -
codeql.yml- CodeQL C# analysis (security-extended) plus GitHub Actions analysis onmain, pull requests, and a weekly schedule. -
dependency-review.yml- fails pull requests that add moderate-or-higher vulnerable dependencies. -
scorecard.yml- OpenSSF Scorecard, published to the public API and code scanning. -
release.yml- the tag-triggered release pipeline: builds the six platform CLI bundles, attests their provenance, creates the GitHub release, publishes the NuGet package, and syncs this documentation to the wiki. See Publish the CLI.
Repository security settings (Dependabot alerts/security updates, secret scanning with push protection, private vulnerability reporting, read-only workflow permissions, and mandatory full-SHA action pinning) are described in SECURITY.md.