Choose a C# library by the job it needs to do: query a database, capture logs, validate input, handle transient failures, build a command-line tool, test behavior, or create a game. This directory covers 14 options with version, license and compatibility checks.
Package examples were checked on Ubuntu 24.04, linux-x64, with .NET SDK 10.0.401 and runtime 10.0.12. Engine capabilities are based on official documentation; no editor or game export was run. These are fit recommendations, not performance rankings.
Start with the task
- Database access: EF Core for a model-driven workflow, Dapper for direct SQL mapping, Npgsql for PostgreSQL connections.
- Application behavior: Serilog for structured logs, FluentValidation for model rules, Polly for controlled retries.
- Developer tools: System.CommandLine for arguments, Spectre.Console for presentation, NSubstitute for test collaborators, BenchmarkDotNet for measurement.
- Games: Unity, Godot and Stride offer editor workflows; MonoGame gives you a code-first framework.
Before adding a dependency
Check your target framework, operating system, database/provider or graphics backend, and distribution license. Pin the package version while reproducing an example. Run the same example in your deployment environment before assuming compatibility. A package target group is not a guarantee that every optional feature, dependency or AOT deployment works.
Begin with the C# learning path, use the video learning guide, or follow the first-game guide.
Entity Framework Core
Use LINQ and tracked entities when a model-driven data layer and migrations fit your application.
Version: 10.0.12 Exact package restored and tested; version snapshot, not perpetual latest claim.
License: MIT
Compatibility: Package dependency target groups: net10.0. Choose the provider for your actual database; the SQLite example demonstrates one provider only.
Use one short-lived context per unit of work. Inspect generated SQL and migrations, and test concurrency against your intended database.
Checked: SQLite insert/read/tracked-update assertions passed.
Official documentation and getting started · Versioned package metadata
Reviewed on 2026-10-04; recheck before adopting.
Dapper
Choose direct SQL when you want explicit control over queries and a small layer for result mapping.
Version: 2.1.89 Exact package restored and tested; version snapshot, not perpetual latest claim.
License: Apache-2.0
Compatibility: Package dependency target groups: net10.0, .NETFramework4.6.1, net8.0, .NETStandard2.0. Uses your ADO.NET provider; SQL dialect, connections and transactions remain application responsibilities.
Parameterize data values. Dapper does not supply the model tracking and migration workflow of a full ORM.
Checked: Parameterized SQLite roundtrip with SQL punctuation passed.
Official documentation and getting started · Versioned package metadata
Reviewed on 2026-10-04; recheck before adopting.
Npgsql
Use this PostgreSQL provider directly for commands or beneath a compatible higher-level data layer.
Version: 10.0.3 Exact package restored and tested; version snapshot, not perpetual latest claim.
License: PostgreSQL
Compatibility: Package dependency target groups: net10.0, net8.0, net9.0. Requires a reachable PostgreSQL service for real database operations; deployment authentication and server features must match.
Reuse a configured data source, dispose acquired connections, and parameterize values. A connection-string builder test does not establish server compatibility.
Checked: Configuration and positional-parameter API assertions passed; no PostgreSQL connection made.
Official documentation and getting started · Versioned package metadata
Reviewed on 2026-10-04; recheck before adopting.
Serilog
Use named event properties when you need to filter and inspect operational logs across application actions.
Version: 4.4.0 Exact package restored and tested; version snapshot, not perpetual latest claim.
License: Apache-2.0
Compatibility: Package dependency target groups: net10.0, .NETFramework4.6.2, .NETFramework4.7.1, net6.0, net8.0, net9.0, .NETStandard2.0. Core logger plus separately chosen sinks; hosting integrations and sink dependencies have their own version constraints.
Keep message templates stable, avoid secret values, and flush asynchronous sinks during shutdown. Logging success is not delivery success for every remote sink.
Checked: Custom in-memory sink captured and asserted a named integer property.
Official documentation and getting started · Versioned package metadata
Reviewed on 2026-10-04; recheck before adopting.
FluentValidation
Choose reusable, strongly typed input rules when the same model is validated at an application boundary.
Version: 12.1.1 Exact package restored and tested; version snapshot, not perpetual latest claim.
License: Apache-2.0
Compatibility: Package dependency target groups: net8.0. Version 12 supports .NET 8 and newer; our fixture targets .NET 10.
Validation does not replace database constraints or authorization. Choose the invocation point deliberately; do not assume every framework integration executes asynchronous rules.
Checked: Valid and invalid name/age fixtures passed.
Official documentation and getting started · Versioned package metadata
Reviewed on 2026-10-04; recheck before adopting.
Polly
Use a bounded resilience pipeline for transient failures when repeating the operation is safe.
Version: 8.8.0 Exact package restored and tested; version snapshot, not perpetual latest claim.
License: BSD-3-Clause
Compatibility: Package dependency target groups: .NETFramework4.6.2, .NETFramework4.7.2, net6.0, net8.0, .NETStandard2.0. This example uses the version 8 pipeline API from Polly.Core; older policy examples are a different API generation.
Choose handled failures and retry counts explicitly. A retried write may run more than once; design idempotency before retrying it. Honor cancellation and timeouts.
Checked: A two-retry pipeline succeeded on the third call and stopped after three calls on persistent failure.
Official documentation and getting started · Versioned package metadata
Reviewed on 2026-10-04; recheck before adopting.
System.CommandLine
Use typed options and parse diagnostics when your console app accepts structured arguments.
Version: 2.0.12 Exact package restored and tested; version snapshot, not perpetual latest claim.
License: MIT
Compatibility: Package dependency target groups: net8.0, .NETStandard2.0. Inspect the installed release API; older prerelease examples can differ. Parsing and rendering are separate from application work.
Treat a successful parse as the start of domain validation. An integer option still needs application-specific range checks.
Checked: Integer option parsed and invalid text produced parse errors.
Official documentation and getting started · Versioned package metadata
Reviewed on 2026-10-04; recheck before adopting.
Spectre.Console
Use tables, progress displays and styled text when a console interface benefits from readable output.
Version: 0.57.2 Exact package restored and tested; version snapshot, not perpetual latest claim.
License: MIT
Compatibility: Package dependency target groups: net10.0, net8.0, net9.0, .NETStandard2.0. Terminal capabilities differ; the library adapts formatting, but test redirected output and noninteractive jobs.
Escape untrusted text before using markup. Prefer plain, stable output for machine consumers; prompts need an interactive terminal.
Checked: User-supplied markup delimiters were escaped correctly; visual rendering was not evaluated.
Official documentation and getting started · Versioned package metadata
Reviewed on 2026-10-04; recheck before adopting.
NSubstitute
Use interface substitutes to isolate a collaborator and assert how your code interacts with it.
Version: 6.2.0 Exact package restored and tested; version snapshot, not perpetual latest claim.
License: BSD-3-Clause
Compatibility: Package dependency target groups: net8.0, .NETStandard2.0. Designed for interfaces and overridable members; dynamic-proxy restrictions matter for class substitutes and AOT targets.
A substitute cannot prove an integration works. Keep separate real database/network fixtures for external behavior.
Checked: Configured interface return value and Received(1) interaction assertion passed.
Official documentation and getting started · Versioned package metadata
Reviewed on 2026-10-04; recheck before adopting.
BenchmarkDotNet
Use a repeatable microbenchmark when comparing a narrowly defined implementation under recorded conditions.
Version: 0.15.8 Exact package restored and tested; version snapshot, not perpetual latest claim.
License: MIT
Compatibility: Package dependency target groups: net6.0, net8.0, .NETStandard2.0. Run a Release build with an appropriate SDK/runtime/toolchain; benchmark jobs and generated executables need their own environment.
Prevent dead-code elimination and use representative inputs. A benchmark is not a production capacity test. No speed ranking is claimed here.
Checked: Attributed fixture compiled and arithmetic was checked; no timed benchmark executed.
Official documentation and getting started · Versioned package metadata
Reviewed on 2026-10-04; recheck before adopting.
Unity
Consider it when you need an editor-driven C# game workflow and can meet the selected platform and licensing requirements.
Version: Documentation baseline checked: Unity 6.0 / 6000.0. This identifies the manual version, not a latest-editor or latest-patch claim. Documentation/release observation; no engine binary tested.
License: Proprietary Unity Editor software terms; plan eligibility and permitted use must be checked for your circumstances. Asset and package licenses are separate.
Compatibility: Editor version is distinct from the scripting backend: Mono provides JIT execution; IL2CPP converts IL to C++ and compiles native code. Select the backend for the player target. Check editor OS requirements separately from player/build targets; installed modules, SDKs and scripting backend vary by target. A desktop .NET SDK version does not establish Unity runtime/API compatibility.
Check the target-specific requirements before committing to a platform; this directory has not built any player. Personal availability does not establish eligibility for every organization or commercial use; recheck current terms before adoption.
Checked: Primary documentation reviewed; editor and target builds not run.
Official documentation and getting started · Primary source · Primary source · Primary source
Reviewed on 2026-10-04; recheck before adopting.
Godot with C#
Consider it for a scene-based open-source C# game workflow after checking your intended export target.
Version: Observed archive release: 4.7.2-stable (18 August 2026). The archive also lists 4.8 development builds; development is not stable. Export statements below reflect retrieved stable documentation. Documentation/release observation; no engine binary tested.
License: MIT for Godot; retain required notices and check third-party components and assets.
Compatibility: Use the .NET-enabled editor, not the standard executable. Install the build SDK separately; bundled runtime components do not include the build tools. Stable docs list C# desktop exports for Windows, Linux and macOS. Android and iOS remain experimental; iOS export requires macOS and official simulator templates support x64 only. Godot 4 C# projects cannot export to Web.
Pin matching editor/export templates and verify SDK requirements for that exact release. The retrieved basics page gives requirements specifically for Godot 4.5; this directory does not extrapolate them to 4.7.2. Complete a target-device export smoke test before claiming mobile deployment support. No engine or export build was run here.
Checked: Primary documentation reviewed; editor and target builds not run.
Official documentation and getting started · Primary source · Primary source · Primary source
Reviewed on 2026-10-04; recheck before adopting.
Stride
Consider it when you want a C# engine and visual content workflow with source access, subject to a validated editor and game-target setup.
Version: Observed release baseline: Stride 4.3 release notes, dated 14 November 2025, describe .NET 10 and C# 14 integration. No latest-patch claim is made. Documentation/release observation; no engine binary tested.
License: MIT for Stride except files with separate third-party terms; review the dependency/license list.
Compatibility: Game Studio is the editor; game platform targets are separate. Moving repository source-build prerequisites are not automatically requirements for every packaged release. Current support matrix is unresolved in this directory. The retrieved platform page lists old Windows and mobile minima, while 4.3 release notes describe .NET 10. Verify the chosen release, editor host, graphics backend and game target together.
Do not promise modern mobile or desktop compatibility from the legacy platform list alone. A pinned release export/build test is required. Use the official getting-started route for game creation; repository source-build instructions are primarily for engine contributors.
Checked: Primary documentation reviewed; editor and target builds not run.
Official documentation and getting started · Primary source · Primary source · Primary source
Reviewed on 2026-10-04; recheck before adopting.
MonoGame
Choose a code-first game loop when you want to own update, drawing and content organization rather than begin with a scene editor.
Version: Documentation baseline retrieved 4 October 2026; no framework release pinned. Current official guide; no framework installation claimed.
License: Microsoft Public License (MS-PL), with project exceptions and separately licensed third-party dependencies.
Compatibility: A C# game framework rather than a full scene editor. Official docs list desktop/mobile targets; console access requires platform-holder developer approval. Follow the selected OS guide, .NET SDK and content-pipeline prerequisites.
DesktopGL and WindowsDX are different targets. On Linux/macOS the documented effect-compilation setup involves Wine. Do not assume a browser target or unrestricted console deployment.
Checked: Official README, platform and Ubuntu guides reviewed; game window and content pipeline not run.
Official documentation and getting started · Primary source · Primary source · Primary source
Reviewed on 2026-10-04; recheck before adopting.
Two database styles, one useful check
Our Dapper fixture inserted a value containing quotes and SQL punctuation through a parameter, then read it back and checked that the table remained intact. The EF Core fixture created a temporary SQLite database, inserted an entity, updated it through change tracking, cleared tracking and read the persisted value. These checks demonstrate basic use; neither proves behavior against PostgreSQL or SQL Server.
A bounded retry means a bounded number of calls
With Polly.Core 8.8.0, our fixture allowed two retries. The original call plus those retries produced at most three calls. It succeeded when the third call stopped throwing and propagated the exception when every call failed. The fixture used zero delay for deterministic checking; choose delay, jitter, cancellation and handled failures for the real operation.
Keep the comparison current
Reviewed on the date shown; recheck before adopting a version. Recheck licenses, supported targets and breaking changes after major releases. Versions here describe the reviewed examples, not a promise that the same version remains appropriate indefinitely. A minimal smoke test verifies the listed behavior only.