Masterly.NightShift.NetCore 1.0.0

dotnet add package Masterly.NightShift.NetCore --version 1.0.0
                    
NuGet\Install-Package Masterly.NightShift.NetCore -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Masterly.NightShift.NetCore" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Masterly.NightShift.NetCore" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Masterly.NightShift.NetCore" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Masterly.NightShift.NetCore --version 1.0.0
                    
#r "nuget: Masterly.NightShift.NetCore, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Masterly.NightShift.NetCore@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Masterly.NightShift.NetCore&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Masterly.NightShift.NetCore&version=1.0.0
                    
Install as a Cake Tool

Masterly.NightShift.NetCore

Microsoft.Extensions integration for Masterly.NightShift: AddNightShift and AddNightShiftServer for dependency injection, job classes created from your container with a scope per job, logging through ILogger, and the job server as a hosted service. Use it in Worker Services and other Generic Host apps.

This is a package of Masterly.NightShift, reliable background jobs for .NET.

NuGet

Install

ASP.NET Core apps get this package through Masterly.NightShift. For a Worker Service, add it with a storage:

dotnet add package Masterly.NightShift.NetCore
dotnet add package Masterly.NightShift.SqlServer
  • Target frameworks: net8.0, net10.0
  • Dependencies: Masterly.NightShift.Core, and the Microsoft.Extensions.DependencyInjection, Hosting and Logging abstractions: 8.0.x on net8.0, 10.0.x on net10.0, so your app keeps its runtime's versions

Example

A Worker Service that runs jobs, with the job classes created from the container:

using Masterly.NightShift;

var builder = Host.CreateApplicationBuilder(args);

var connectionString = builder.Configuration.GetConnectionString("NightShift")
    ?? throw new InvalidOperationException("Connection string 'NightShift' is missing.");

builder.Services.AddNightShift(config => config
    .SetDataCompatibilityLevel(CompatibilityLevel.Version_180)
    .UseSimpleAssemblyNameTypeSerializer()
    .UseRecommendedSerializerSettings()
    .UseSqlServerStorage(connectionString));

builder.Services.AddNightShiftServer(options =>
{
    options.WorkerCount = 4;
});

builder.Services.AddTransient<ReportService>();

var host = builder.Build();

host.Services.GetRequiredService<IRecurringJobManager>()
    .AddOrUpdate<ReportService>("daily-report", x => x.BuildDaily(), Cron.Daily(6));

host.Run();

public class ReportService
{
    private readonly ILogger<ReportService> _logger;

    public ReportService(ILogger<ReportService> logger) => _logger = logger;

    public void BuildDaily() => _logger.LogInformation("Daily report built");
}

Each job runs inside a logging scope with its job id and name.

Documentation

What AddNightShift and AddNightShiftServer register, job activation and scopes, and server options from configuration are covered in the full documentation: https://a7mdfre7at.github.io/Masterly.NightShift/docs/server/dependency-injection

License

MIT AND LGPL-3.0-or-later: code written for Masterly.NightShift is MIT, code derived from Hangfire stays under the LGPL. The package contains both license texts.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Masterly.NightShift.NetCore:

Package Downloads
Masterly.NightShift.AspNetCore

Masterly.NightShift for ASP.NET Core: the dashboard as an endpoint or middleware, health checks, and /health and Prometheus /metrics endpoints.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 0 11/16/2026