![]() |
VOOZH | about |
dotnet add package Quartz --version 3.18.1
NuGet\Install-Package Quartz -Version 3.18.1
<PackageReference Include="Quartz" Version="3.18.1" />
<PackageVersion Include="Quartz" Version="3.18.1" />Directory.Packages.props
<PackageReference Include="Quartz" />Project file
paket add Quartz --version 3.18.1
#r "nuget: Quartz, 3.18.1"
#:package Quartz@3.18.1
#addin nuget:?package=Quartz&version=3.18.1Install as a Cake Addin
#tool nuget:?package=Quartz&version=3.18.1Install as a Cake Tool
Welcome to the Quick Start Guide for Quartz.NET. As you read this guide, expect to see details of:
You can either download the zip file or use the NuGet package. NuGet package contains only the binaries needed to run Quartz.NET, zip file comes with source code, samples and Quartz.NET server sample application.
Couldn't get any simpler than this. Just fire up Visual Studio (with NuGet installed) and add reference to package Quartz from package manager extension:
or from NuGet Command-Line:
Install-Package Quartz
If you want to add JSON Serialization, just add the package the same way.
Short version: Once you've downloaded Quartz.NET, unzip it somewhere, grab the Quartz.dll from bin directory and start to use it.
Quartz core library does not have any hard binary dependencies. You can opt-in to more dependencies when you choose to use JSON serialization package, which requires JSON.NET.
You need to have at least Quartz.dll beside your app binaries to successfully run Quartz.NET. So just add it as a references to your Visual Studio project that uses them.
You can find these dlls from extracted archive from path bin\your-target-framework-version\release\Quartz.
This is the big bit! Quartz.NET is a very configurable library. There are two main ways (which are not mutually exclusive) to supply Quartz.NET configuration information:
You can configure scheduler using C# fluent API, or via providing NameValueCollection parameter to scheduler factory
which contains configuration keys and values.
// you can have base properties
var properties = new NameValueCollection();
// and override values via builder
IScheduler scheduler = await SchedulerBuilder.Create(properties)
// default max concurrency is 10
.UseDefaultThreadPool(x => x.MaxConcurrency = 5)
// this is the default
// .WithMisfireThreshold(TimeSpan.FromSeconds(60))
.UsePersistentStore(x =>
{
// force job data map values to be considered as strings
// prevents nasty surprises if object is accidentally serialized and then
// serialization format breaks, defaults to false
x.UseProperties = true;
x.UseClustering();
// there are other SQL providers supported too
x.UseSqlServer("my connection string");
// this requires Quartz.Serialization.Json NuGet package
x.UseJsonSerializer();
})
// job initialization plugin handles our xml reading, without it defaults are used
// requires Quartz.Plugins NuGet package
.UseXmlSchedulingConfiguration(x =>
{
x.Files = new[] { "~/quartz_jobs.xml" };
// this is the default
x.FailOnFileNotFound = true;
// this is not the default
x.FailOnSchedulingError = true;
})
.BuildScheduler();
await scheduler.Start();
Following files are searched for known configuration properties:
YourApplication.exe.config configuration file using quartz-element (full .NET framework only)appsettings.json (.NET Core/NET5 onwards)quartz.config file in your application's root directory (works both with .NET Core and full .NET Framework)Full documentation of available properties is available in the .
To get up and running quickly, a basic quartz.config looks something like this:
quartz.scheduler.instanceName = MyScheduler
quartz.jobStore.type = Quartz.Simpl.RAMJobStore, Quartz
quartz.threadPool.maxConcurrency = 3
Remember to set the Copy to Output Directory on Visual Studio's file property pages to have value Copy always. Otherwise the config will not be seen if it's not in build directory.
The scheduler created by this configuration has the following characteristics:
quartz.scheduler.instanceName - This scheduler's name will be "MyScheduler".
quartz.threadPool.maxConcurrency - Maximum of 3 jobs can be run simultaneously (default is 10).
quartz.jobStore.type - All of Quartz's data, such as details of jobs and triggers, is held in memory (rather than in a database).
Even if you have a database and want to use it with Quartz, I suggest you get Quartz working with the RamJobStore before you open up a whole new dimension by working with a database.
::: tip Actually you don't need to define these properties if you don't want to, Quartz.NET comes with sane defaults :::
Now you've downloaded and installed Quartz, it's time to get a sample application up and running. The following code obtains an instance of the scheduler, starts it, then shuts it down:
Program.cs
using System;
using System.Threading.Tasks;
using Quartz;
using Quartz.Impl;
namespace QuartzSampleApp
{
public class Program
{
private static async Task Main(string[] args)
{
// Grab the Scheduler instance from the Factory
StdSchedulerFactory factory = new StdSchedulerFactory();
IScheduler scheduler = await factory.GetScheduler();
// and start it off
await scheduler.Start();
// some sleep to show what's happening
await Task.Delay(TimeSpan.FromSeconds(10));
// and last shut down the scheduler when you are ready to close your program
await scheduler.Shutdown();
}
}
}
As of Quartz 3.0 your application will terminate when there's no code left to execute after scheduler.Shutdown(), because there won't be any active threads. You should manually block exiting of application if you want scheduler to keep running also after the Task.Delay and Shutdown has been processed.
Now running the program will not show anything. When 10 seconds have passed the program will just terminate. Lets add some logging to console.
LibLog can be configured to use different logging frameworks under the hood; namely Log4Net, NLog and Serilog.
When LibLog does not detect any other logging framework to be present, it will be silent. We can configure a custom logger provider that just logs to console show the output if you don't have logging framework setup ready yet.
LogProvider.SetCurrentLogProvider(new ConsoleLogProvider());
private class ConsoleLogProvider : ILogProvider
{
public Logger GetLogger(string name)
{
return (level, func, exception, parameters) =>
{
if (level >= LogLevel.Info && func != null)
{
Console.WriteLine("[" + DateTime.Now.ToLongTimeString() + "] [" + level + "] " + func(), parameters);
}
return true;
};
}
public IDisposable OpenNestedContext(string message)
{
throw new NotImplementedException();
}
public IDisposable OpenMappedContext(string key, object value, bool destructure = false)
{
throw new NotImplementedException();
}
}
Now we should get a lot more information when we start the application.
[12.51.10] [Info] Quartz.NET properties loaded from configuration file 'C:\QuartzSampleApp\quartz.config'
[12.51.10] [Info] Initialized Scheduler Signaller of type: Quartz.Core.SchedulerSignalerImpl
[12.51.10] [Info] Quartz Scheduler created
[12.51.10] [Info] RAMJobStore initialized.
[12.51.10] [Info] Scheduler meta-data: Quartz Scheduler (v3.0.0.0) 'MyScheduler' with instanceId 'NON_CLUSTERED'
Scheduler class: 'Quartz.Core.QuartzScheduler' - running locally.
NOT STARTED.
Currently in standby mode.
Number of jobs executed: 0
Using thread pool 'Quartz.Simpl.DefaultThreadPool' - with 3 threads.
Using job-store 'Quartz.Simpl.RAMJobStore' - which does not support persistence. and is not clustered.
[12.51.10] [Info] Quartz scheduler 'MyScheduler' initialized
[12.51.10] [Info] Quartz scheduler version: 3.0.0.0
[12.51.10] [Info] Scheduler MyScheduler_$_NON_CLUSTERED started.
We need a simple test job to test the functionality, lets create HelloJob that outputs greetings to console.
public class HelloJob : IJob
{
public async Task Execute(IJobExecutionContext context)
{
await Console.Out.WriteLineAsync("Greetings from HelloJob!");
}
}
To do something interesting, you need code just after Start() method, before the Task.Delay.
// define the job and tie it to our HelloJob class
IJobDetail job = JobBuilder.Create<HelloJob>()
.WithIdentity("job1", "group1")
.Build();
// Trigger the job to run now, and then repeat every 10 seconds
ITrigger trigger = TriggerBuilder.Create()
.WithIdentity("trigger1", "group1")
.StartNow()
.WithSimpleSchedule(x => x
.WithIntervalInSeconds(10)
.RepeatForever())
.Build();
// Tell quartz to schedule the job using our trigger
await scheduler.ScheduleJob(job, trigger);
// You could also schedule multiple triggers for the same job with
// await scheduler.ScheduleJob(job, new List<ITrigger>() { trigger1, trigger2 }, replace: true);
The complete console application will now look like this
using System;
using System.Threading.Tasks;
using Quartz;
using Quartz.Impl;
using Quartz.Logging;
namespace QuartzSampleApp
{
public class Program
{
private static async Task Main(string[] args)
{
LogProvider.SetCurrentLogProvider(new ConsoleLogProvider());
// Grab the Scheduler instance from the Factory
StdSchedulerFactory factory = new StdSchedulerFactory();
IScheduler scheduler = await factory.GetScheduler();
// and start it off
await scheduler.Start();
// define the job and tie it to our HelloJob class
IJobDetail job = JobBuilder.Create<HelloJob>()
.WithIdentity("job1", "group1")
.Build();
// Trigger the job to run now, and then repeat every 10 seconds
ITrigger trigger = TriggerBuilder.Create()
.WithIdentity("trigger1", "group1")
.StartNow()
.WithSimpleSchedule(x => x
.WithIntervalInSeconds(10)
.RepeatForever())
.Build();
// Tell quartz to schedule the job using our trigger
await scheduler.ScheduleJob(job, trigger);
// some sleep to show what's happening
await Task.Delay(TimeSpan.FromSeconds(60));
// and last shut down the scheduler when you are ready to close your program
await scheduler.Shutdown();
Console.WriteLine("Press any key to close the application");
Console.ReadKey();
}
// simple log provider to get something to the console
private class ConsoleLogProvider : ILogProvider
{
public Logger GetLogger(string name)
{
return (level, func, exception, parameters) =>
{
if (level >= LogLevel.Info && func != null)
{
Console.WriteLine("[" + DateTime.Now.ToLongTimeString() + "] [" + level + "] " + func(), parameters);
}
return true;
};
}
public IDisposable OpenNestedContext(string message)
{
throw new NotImplementedException();
}
public IDisposable OpenMappedContext(string key, object value, bool destructure = false)
{
throw new NotImplementedException();
}
}
}
public class HelloJob : IJob
{
public async Task Execute(IJobExecutionContext context)
{
await Console.Out.WriteLineAsync("Greetings from HelloJob!");
}
}
}
In order to use SQL persistence storage for Quartz and enabling features like clustering, you need to create a database and initialize the schema objects using SQL scripts. First you need to create a database and credentials for Quartz. After you have a database that Quartz will be able to connect to, you also need to create database tables and indexes that Quartz needs for successful operation.
You can find latest DDL scripts in Quartz's GitHub repository and they are also contained in the ZIP archive distribution. There are also thirty party additions to Quartz that enable other types of storage, like NoSQL databases. You can search for them on NuGet.
Now go have some fun exploring Quartz.NET! You can continue by reading .
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 is compatible. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 is compatible. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 5 NuGet packages that depend on Quartz:
| Package | Downloads |
|---|---|
|
Quartz.Extensions.DependencyInjection
Quartz.NET Microsoft.Extensions.DependencyInjection integration; Quartz Scheduling Framework for .NET |
|
|
Quartz.Serialization.Json
Quartz.NET JSON Serialization Support; Quartz Scheduling Framework for .NET |
|
|
MassTransit.Quartz
MassTransit Quartz.NET scheduler support; MassTransit provides a developer-focused, modern platform for creating distributed applications without complexity. |
|
|
WasmAI.AutoGenerator
is a powerful code-generation library for .NET 8 that automates the scaffolding of backend components like models, services, controllers, and more—based on a flexible folder configuration. |
|
|
Quartz.Jobs
Quartz.NET Jobs; Quartz Scheduling Framework for .NET |
Showing the top 20 popular GitHub repositories that depend on Quartz:
| Repository | Stars |
|---|---|
|
bitwarden/server
Bitwarden infrastructure/backend (API, database, Docker, etc).
|
|
|
abpframework/abp
Open-source web application framework for ASP.NET Core! Offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET. Provides the fundamental infrastructure, cross-cutting-concern implementations, startup templates, application modules, UI themes, tooling and documentation.
|
|
|
kgrzybek/modular-monolith-with-ddd
Full Modular Monolith application with Domain-Driven Design approach.
|
|
|
aspnetboilerplate/aspnetboilerplate
ASP.NET Boilerplate - Web Application Framework
|
|
|
RayWangQvQ/BiliBiliToolPro
B 站(bilibili)自动任务工具,支持docker、青龙、k8s等多种部署方式。全面拥抱AI。敏感肌也能用。
|
|
|
MassTransit/MassTransit
Distributed Application Framework for .NET
|
|
|
anjoy8/Blog.Core
💖 ASP.NET Core 8.0 全家桶教程,前后端分离后端接口,vue教程姊妹篇,官方文档:
|
|
|
Jeric-X/SyncClipboard
跨平台剪贴板同步、历史记录管理工具 / Cross-platform cipboard syncing, history management tool
|
|
|
dotnetcore/Util
Util是一个.Net平台下的应用框架,旨在提升中小团队的开发能力,由工具类、分层架构基类、Ui组件,配套代码生成模板,权限等组成。
|
|
|
dotnetcore/WTM
Use WTM to write .netcore app fast !!!
|
|
|
cq-panda/Vue.NetCore
(已支持sqlsugar).NetCore、.Net6、Vue2、Vue3、Vite、TypeScript、Element plus+uniapp前后端分离,全自动生成代码;支持移动端(ios/android/h5/微信小程序。http://www.volcore.xyz/
|
|
|
Ombi-app/Ombi
Want a Movie or TV Show on Plex/Emby/Jellyfin? Use Ombi!
|
|
|
oskardudycz/EventSourcing.NetCore
Examples and Tutorials of Event Sourcing in .NET
|
|
|
Arcenox-co/TickerQ
TickerQ is a fast, reflection-free background task scheduler for .NET built with source generators, EF Core integration, cron + time-based execution, and a real-time dashboard.
|
|
|
kgrzybek/sample-dotnet-core-cqrs-api
Sample .NET Core REST API CQRS implementation with raw SQL and DDD using Clean Architecture.
|
|
|
BookerLiu/GeekDesk
🔥小巧、美观的桌面快速启动工具 Small, beautiful desktop quickstart management tool with integrated Everything search
|
|
|
liukuo362573/YiShaAdmin
基于 .NET Core MVC 的权限管理系统,代码易读易懂、界面简洁美观
|
|
|
BrighterCommand/Brighter
A framework for building messaging apps with .NET and C#.
|
|
|
phongnguyend/Practical.CleanArchitecture
Full-stack .Net 10 Clean Architecture (Microservices, Modular Monolith, Monolith), Blazor, Angular 21, React 19, Vue 3.5, BFF with YARP, NextJs 16, Domain-Driven Design, CQRS, SOLID, Asp.Net Core Identity Custom Storage, OpenID Connect, EF Core, OpenTelemetry, SignalR, Background Services, Health Checks, Rate Limiting, Clouds (Azure, AWS, GCP), ...
|
|
|
Cleanuparr/Cleanuparr
Advanced download manager for the Servarr ecosystem
|
| Version | Downloads | Last Updated |
|---|---|---|
| 3.18.1 | 1,056,965 | 4/25/2026 |
| 3.18.0 | 422,278 | 4/11/2026 |
| 3.17.1 | 265,678 | 4/3/2026 |
| 3.17.0 | 263,672 | 3/29/2026 |
| 3.16.1 | 1,082,292 | 3/4/2026 |
| 3.16.0 | 1,576,970 | 3/1/2026 |
| 3.15.1 | 5,682,420 | 10/26/2025 |
| 3.15.0 | 3,985,150 | 8/3/2025 |
| 3.14.0 | 9,110,173 | 3/8/2025 |
| 3.13.1 | 13,527,681 | 11/2/2024 |
| 3.13.0 | 6,331,442 | 8/10/2024 |
| 3.12.0 | 662,858 | 8/3/2024 |
| 3.11.0 | 2,326,102 | 7/7/2024 |
| 3.10.0 | 700,113 | 6/26/2024 |
| 3.9.0 | 3,443,503 | 5/9/2024 |
| 3.8.1 | 6,096,831 | 2/17/2024 |
| 3.8.0 | 7,984,001 | 11/18/2023 |
| 3.7.0 | 4,887,944 | 8/4/2023 |
| 3.6.3 | 2,007,151 | 6/25/2023 |
| 3.6.2 | 7,525,858 | 2/25/2023 |