Skip to content

Package Guides

Compono ships as thirteen independently-installable NuGet packages. Pick which ones you need before reading any single guide in depth — most projects only need the first two.

Package What it adds Install if...
Compono The core composition engine: Composer, the resolution pipeline, and the source generator (embedded, no separate install). Always — every other package depends on it.
Compono.XunitV3 [Compose]/[Compose<TProfile>]/[Compose<TProfile, TConfig>] theory data attributes and [Shared] parameter sharing for xUnit v3. You write xUnit v3 tests and want composed theory parameters instead of hand-built test data.
Compono.XunitV3.Aot [Compose] (Phase 1: plain form only) for xUnit v3 test projects publishing as Native AOT, via xUnit's own xunit.v3.aot.mtp-v2 package family. Your xUnit v3 test project publishes with PublishAot=true — never install alongside Compono.XunitV3 in the same project.
Compono.NSubstitute Automatic substitute composition for interface, delegate, and (optionally) abstract-class parameters. Your composed types depend on interfaces you'd otherwise stub by hand with NSubstitute.
Compono.Bogus Realistic fake data — member-name-convention matching plus explicit Faker<T> sugar. You want FullName/Email/StreetAddress-shaped fields to look like real data instead of anonymous strings.
Compono.TUnit [Compose]/[Compose<TProfile>]/[Compose<TProfile, TConfig>] data source attributes and [Shared] parameter sharing for TUnit. You write TUnit tests and want composed method parameters instead of hand-built data sources.
Compono.MSTest [Compose]/[Compose<TProfile>]/[Compose<TProfile, TConfig>] ITestDataSource attributes and [Shared] parameter sharing for MSTest. You write MSTest tests and want composed method parameters instead of hand-built [DataRow]/[DynamicData] rows.
Compono.NUnit [Compose]/[Compose<TProfile>]/[Compose<TProfile, TConfig>] TestAttribute/ITestBuilder attributes and [Shared] parameter sharing for NUnit. No [TestFixture] required. You write NUnit tests and want composed method parameters instead of hand-built [TestCase]/[Values] rows.
Compono.TestDoubles A source-generated, AOT-safe double for an otherwise-unresolvable interface leaf, with per-member Configure().Member().Returns(...)/.Throws(...). You want a generated interface double without Compono.NSubstitute's runtime-proxy dependency, or need the composed path to survive PublishAot.
Compono.DependencyInjection row.AsServiceProvider() — a configured-resolution IServiceProvider bridge over a CompositionRow. You need Compono's registered/provider-backed values reachable through a plain IServiceProvider, e.g. as a fallback provider for another ecosystem's own DI container.
Compono.Http TestHttpHandler — a reflection-free HttpMessageHandler test double: OnGet/OnPost/etc. + When(...) matching, strict unmatched-request behavior, registration-handle verification. Your test needs to exercise the real HttpClient pipeline against a configured HTTP response, instead of substituting an application-level interface.
Compono.Logging UseLogging() — ILogger/ILogger<T> compose as a hand-written CapturingLogger/CapturingLogger<T>, with structured-property extraction, real scope tracking, and Verify() verification. Generation is on by default once installed. Your composed type takes an ILogger/ILogger<T> dependency and the test wants to assert what was logged.
Compono.Options TestOptionsSource<T>/UseOptions<T>() — one test-configured source of truth coherently backing IOptions<T>/IOptionsSnapshot<T>/IOptionsMonitor<T> for a settings type. Your composed type depends on IOptions<T>/IOptionsSnapshot<T>/IOptionsMonitor<T> and the test wants one coherent source, not hand-wired separate registrations or a buggy hand-rolled Monitor fake.

Every package targets net8.0/net9.0/net10.0/net11.0 and has a stable release, except Compono.XunitV3.Aot (net9.0/net10.0/net11.0 only — matching xUnit v3's own Native AOT floor) — see Installation for the exact dotnet add package commands. See ADR-0038 for why net8.0/ net9.0 were added alongside the existing net10.0/net11.0 window.

Compono.Generators (the source generator itself) is not a separate package you install — it's embedded inside Compono.nupkg's analyzers/dotnet/cs and activates automatically once you reference Compono. See Compono for what that means in practice.

The common case

For most test projects, that's Compono plus whichever test-framework integration matches your test host — Compono.XunitV3 for xUnit v3, Compono.TUnit for TUnit, Compono.MSTest for MSTest, or Compono.NUnit for NUnit:

dotnet add package Compono
dotnet add package Compono.XunitV3
# or, for TUnit:
dotnet add package Compono.TUnit
# or, for MSTest:
dotnet add package Compono.MSTest
# or, for NUnit:
dotnet add package Compono.NUnit

Add Compono.NSubstitute and/or Compono.Bogus independently, as your tests need them — neither depends on the other, and both depend only on Compono, never on Compono.XunitV3 (composing plain object graphs with NSubstitute-provided substitutes or Bogus-generated data works the same whether or not you're also using xUnit v3 integration).

Version compatibility

All twelve packages ship in lockstep during the 0.x line — each integration package's dependency on Compono is exact-pinned at pack time, so mixing versions across packages (e.g. Compono.XunitV3 0.3.0 with Compono 0.5.0) is not supported and will fail to restore. Always update all installed Compono packages together — see ADR-0031 for the full 0.x versioning policy.