Soenneker.Cron.Builder
11.0.377
Prefix Reserved
dotnet add package Soenneker.Cron.Builder --version 11.0.377
NuGet\Install-Package Soenneker.Cron.Builder -Version 11.0.377
<PackageReference Include="Soenneker.Cron.Builder" Version="11.0.377" />
<PackageVersion Include="Soenneker.Cron.Builder" Version="11.0.377" />
<PackageReference Include="Soenneker.Cron.Builder" />
paket add Soenneker.Cron.Builder --version 11.0.377
#r "nuget: Soenneker.Cron.Builder, 11.0.377"
#:package Soenneker.Cron.Builder@11.0.377
#addin nuget:?package=Soenneker.Cron.Builder&version=11.0.377
#tool nuget:?package=Soenneker.Cron.Builder&version=11.0.377
Soenneker.Cron.Builder
A mutable fluent builder for five-field cron expressions, with optional leading seconds for six-field schedulers.
Installation
dotnet add package Soenneker.Cron.Builder
Common schedules
Construct a new builder for each expression; no dependency-injection registration is required.
using Soenneker.Cron.Builder;
using Soenneker.Enums.DayOfWeek;
string everyFiveMinutes = new CronBuilder()
.WithMinuteInterval(5)
.Build();
// */5 * * * *
string weekdayMorning = new CronBuilder()
.Daily(hour: 9, minute: 30)
.Weekdays()
.Build();
// 30 9 * * MON-FRI
string mondayAtNoon = new CronBuilder()
.Weekly(DayOfWeekType.Monday, hour: 12)
.Build();
// 0 12 * * MON
string firstOfMonth = new CronBuilder()
.Monthly(dayOfMonth: 1, hour: 2, minute: 15)
.Build();
// 15 2 1 * *
ToString() returns the same value as Build().
Field order and defaults
Without WithSeconds, output uses the conventional order:
minute hour day-of-month month day-of-week
The untouched builder produces 0 * * * *, which means the top of every hour. Minutely() changes the minute field to *; Hourly() sets minute to 0 and hour to *.
Calling WithSeconds adds a leading seconds field:
string expression = new CronBuilder()
.WithSeconds(30)
.Minutely()
.Build();
// 30 * * * * *
Six-field cron dialects are not universal. Confirm that the target scheduler interprets the first field as seconds before using this form.
Composition rules
Builder calls update individual fields; they do not reset unrelated fields. This allows combinations such as Daily(...).Weekdays(), but reusing a builder also retains earlier month or day restrictions. Create a new builder when starting a different schedule.
Numeric ranges are checked for seconds, minutes, hours, day of month, month, and interval methods. Build() rejects a fixed day of month combined with any day-of-week restriction because that combination has scheduler-dependent semantics.
OnDayOfWeek(string) uppercases and emits the supplied token unchanged. Use it only for syntax supported by the target scheduler; the builder does not validate raw expressions.
The builder only formats expressions. It does not evaluate schedules, apply a time zone, account for daylight-saving transitions, or register jobs with a scheduler. Instances are mutable and should not be shared across concurrent expression construction.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- Soenneker.Enums.DayOfWeek (>= 11.0.806)
- Soenneker.Extensions.String (>= 11.0.820)
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 |
|---|---|---|
| 11.0.377 | 49 | 11/14/2026 |
| 11.0.376 | 72 | 11/11/2026 |
| 11.0.375 | 76 | 11/11/2026 |
| 11.0.374 | 67 | 11/11/2026 |
| 11.0.373 | 70 | 11/11/2026 |
| 11.0.372 | 84 | 11/11/2026 |
| 11.0.371 | 82 | 11/11/2026 |
| 11.0.370 | 79 | 11/11/2026 |
| 11.0.369 | 92 | 11/3/2026 |
| 11.0.368 | 94 | 11/3/2026 |
| 11.0.367 | 97 | 11/2/2026 |
| 11.0.366 | 107 | 10/27/2026 |
| 11.0.365 | 100 | 10/27/2026 |
| 11.0.364 | 95 | 10/26/2026 |
| 11.0.363 | 98 | 10/26/2026 |
| 11.0.362 | 87 | 10/26/2026 |
| 11.0.361 | 90 | 10/26/2026 |
| 11.0.360 | 100 | 10/26/2026 |
| 4.0.359 | 258 | 10/15/2026 |
| 4.0.358 | 106 | 10/14/2026 |
Update dependency Soenneker.Enums.DayOfWeek to 11.0.806 (#992)