
.NET (C#)
CertifiedTasks that run .NET C# scripts using dotnet-script.
Provide C# code inline as .csx scripts or run arbitrary dotnet CLI commands inside a .NET SDK container, capturing stdout/stderr and any output files for subsequent steps.
.NET (C#)
Tasks that run .NET C# scripts using dotnet-script.
Provide C# code inline as .csx scripts or run arbitrary dotnet CLI commands inside a .NET SDK container, capturing stdout/stderr and any output files for subsequent steps.
tasks
How to use the .NET (C#) plugin
Run C# scripts and dotnet CLI commands from Kestra workflows using dotnet-script inside a .NET SDK container.
Authentication
This plugin has no authentication properties. Use environment variables for secrets (e.g., connection strings, API keys) passed via env on the task, or use {{ secret('SECRET_NAME') }} in your script body.
Tasks
Script
Runs an inline C# script defined in the script property. The script is written to a temporary .csx file and executed with dotnet-script.
dotnet-script is installed automatically via dotnet tool install -g dotnet-script before each run. To avoid the installation overhead, use a custom containerImage that already includes dotnet-script.
NuGet package references work out of the box — place #r "nuget: PackageName,Version" directives at the top of your script. The first run with a new package reference triggers a NuGet restore which may take 30–60 seconds.
Required properties:
script— inline C# script body in.csxformat
Optional:
containerImage— defaults tomcr.microsoft.com/dotnet/sdk: 10.0beforeCommands— shell commands to run before the script (e.g., set environment variables)inputFiles— additional files to stage alongside the scriptoutputFiles— glob patterns for files to capture into Kestra internal storagetaskRunner— override the execution environment (default: Docker)
Commands
Runs arbitrary shell commands sequentially inside a .NET SDK container. Use this task when script files live in namespace files or are cloned from a Git repository, or when you need raw dotnet CLI access (e.g., dotnet build, dotnet test).
dotnet-script is not pre-installed in the default image. Add the following to beforeCommands when running .csx files:
beforeCommands:
- dotnet tool install -g dotnet-script --ignore-failed-sources || true
- export PATH="$PATH: $HOME/.dotnet/tools"
Required properties:
commands— list of shell commands to execute in order
Optional:
containerImage— defaults tomcr.microsoft.com/dotnet/sdk: 10.0beforeCommands,inputFiles,namespaceFiles,outputFiles,taskRunner— same asScript