BlackSharp.Platform.Startup 1.3.2

Prefix Reserved
dotnet add package BlackSharp.Platform.Startup --version 1.3.2
                    
NuGet\Install-Package BlackSharp.Platform.Startup -Version 1.3.2
                    
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="BlackSharp.Platform.Startup" Version="1.3.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BlackSharp.Platform.Startup" Version="1.3.2" />
                    
Directory.Packages.props
<PackageReference Include="BlackSharp.Platform.Startup" />
                    
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 BlackSharp.Platform.Startup --version 1.3.2
                    
#r "nuget: BlackSharp.Platform.Startup, 1.3.2"
                    
#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 BlackSharp.Platform.Startup@1.3.2
                    
#: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=BlackSharp.Platform.Startup&version=1.3.2
                    
Install as a Cake Addin
#tool nuget:?package=BlackSharp.Platform.Startup&version=1.3.2
                    
Install as a Cake Tool

<h1 align="center">BlackSharp.Platform.Startup</h1>

<p align="center"> <img src="https://raw.githubusercontent.com/Blacktempel/BlackSharp/master/Assets/BlackSharpFull.png" width="128" height="128" alt="BlackSharp.Platform.Startup logo"/> </p>

NuGet NuGet downloads .NET Framework .NET GitHub Sponsors PayPal License

BlackSharp.Platform.Startup registers application commands for system boot or user login.

Features

  • Windows boot tasks that run as SYSTEM through Task Scheduler
  • Non-elevated Windows login tasks for the current user or a specified group
  • Linux system-wide boot registration with systemd
  • XDG desktop autostart entries for graphical Linux sessions
  • Separate executable paths, arguments and working directories through StartupCommand

Supported .NET versions

.NET version Support
.NET Framework 4.7.2 ✅
.NET Framework 4.8.1 ✅
.NET Standard 2.0 ✅
.NET 8 ✅
.NET 9 ✅
.NET 10 ✅
.NET 11 ✅

NuGet

dotnet add package BlackSharp.Platform.Startup

Supported platforms

Operating system Support Boot registration Login registration
Windows ✅ Task Scheduler boot task Task Scheduler login task
Linux ✅ System-level systemd service XDG desktop autostart file
Other ❌ Not supported Not supported

Boot registration needs administrative privileges. On Linux, a writable /etc/systemd/system and a working systemctl are required for system-level registration. XDG autostart requires a desktop environment that reads those entries and write access to the selected autostart directory. Windows login tasks run non-elevated; creating or removing a task still requires permission to manage that task.

ProcessPrivilege.IsElevated checks the current process for an administrator token on Windows or an effective user ID of zero on Linux.

Usage

Register startup at graphical login

Call this when the user enables or disables startup in your application's settings. Supply the absolute path to the installed executable and pass each argument separately. This example uses the platform checks in modern .NET.

using BlackSharp.Platform.Startup.Models;
using BlackSharp.Platform.Startup.Platform.Linux;
using BlackSharp.Platform.Startup.Platform.Windows;

static void SetStartAtLogin(string executablePath, bool enabled)
{
    var command = new StartupCommand(
        executablePath,
        new[] { "--minimized" },
        Path.GetDirectoryName(executablePath)!);

    if (OperatingSystem.IsWindows())
    {
        WindowsTaskStartupRegistration.SetCurrentUserLoginTaskEnabled(
            "ExampleApp", "Start Example App at login", command, enabled);
    }
    else if (OperatingSystem.IsLinux())
    {
        var directory = LinuxDesktopAutostartRegistration.GetCurrentUserAutostartDirectory();
        var desktopEntryPath = Path.Combine(directory, "example-app.desktop");

        LinuxDesktopAutostartRegistration.SetEnabled(
            desktopEntryPath, "Example App", command, enabled);
    }
    else
    {
        throw new PlatformNotSupportedException();
    }
}

Configure a boot command

Use WindowsTaskStartupRegistration.SetBootTaskEnabled or LinuxSystemdStartupRegistration.SetEnabled for a non-interactive boot process. Use a task or unit name owned by your application. Boot registration runs with system privileges; place the executable in a trusted installation directory.

On Linux, you can preview the unit:

using BlackSharp.Platform.Startup.Models;
using BlackSharp.Platform.Startup.Platform.Linux;

var command = new StartupCommand(
    "/opt/example-agent/example-agent",
    Array.Empty<string>(),
    "/opt/example-agent");

Console.WriteLine(LinuxSystemdStartupRegistration.CreateUnitContent(
    "Example background agent", command));

The systemd registration method accepts a simple unit name ending in .service. It enables the unit for boot. Disabling it removes the registration.

Support and license

Report issues in the BlackSharp issue tracker. Licensed under the Mozilla Public License 2.0.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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 is compatible.  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.  net11.0 is compatible. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 is compatible.  net48 was computed.  net481 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
1.3.2 97 11/30/2026
1.3.1 108 11/24/2026
1.3.0 105 11/21/2026
1.2.12 116 11/16/2026
1.2.11 121 11/10/2026
1.2.10 109 11/6/2026
1.2.9 107 11/4/2026
1.2.8 117 11/1/2026
1.2.7 106 10/30/2026
1.2.6 105 10/28/2026
1.2.5 119 10/23/2026
1.2.4 111 10/22/2026