Version v1.0 · dotnet

Job Discovery and Assemblies

How DurableStack discovers jobs, and how to register jobs from a different project or assembly.

Overview

DurableStack discovers job types at startup.

By default, auto-discovery scans the application assembly (the assembly where your host starts).

If your jobs live in a different project/assembly, they will not be discovered unless you explicitly register that assembly.

Common scenario

In many real-world solutions, the application host and job implementations are intentionally separated across projects. DurableStack starts from the host assembly, so default auto-discovery only sees job types loaded from that assembly. When jobs are defined in another referenced assembly, explicitly registering that assembly ensures they are discovered and registered at startup.

Register jobs from another assembly

Use AddDurableJobsFromAssembly and point it to an assembly that contains your job types.

services.AddDurableStack(options =>
{
    options.UsePostgres(DataSettingsManager.LoadSettings().ConnectionString);
});

services.AddDurableJobsFromAssembly(typeof(ClearCacheTask).Assembly);

ClearCacheTask is just an anchor type. DurableStack scans that assembly and discovers all matching job types there.

  • Keep your normal AddDurableStack(...) registration.
  • Add one AddDurableJobsFromAssembly(...) call per external assembly that contains jobs.
  • Use a stable, known job type from that project as the anchor (typeof(SomeJob).Assembly).

Multiple assemblies

If jobs are split across projects, register each assembly explicitly.

services.AddDurableJobsFromAssembly(typeof(BillingJobsAssemblyMarker).Assembly);
services.AddDurableJobsFromAssembly(typeof(ReportingJobsAssemblyMarker).Assembly);

Troubleshooting checklist

  • Confirm the jobs project is referenced by the host project.
  • Confirm job types are public and implement DurableStack job contracts.
  • Confirm registration runs during startup before worker execution begins.
  • If no jobs appear, log startup and verify the external assembly registration path is executed.