process-api-net11
What it does
This skill explains how to use the new Process APIs in .NET 11 to run external programs, capture their output and manage their lifetime. It is for developers building .NET 11 apps that start other programs.
When to use it
- ✓When your .NET 11 app needs to run an external program and capture its output.
- ✓When child processes should close automatically when the parent app exits.
- ✓When you need to start a detached process or control which handles a child inherits.
Skill link
https://github.com/dotnet/skills/blob/main/plugins/dotnet11/skills/process-api-net11/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“In my .NET 11 app, run a command-line tool, capture its text output and make sure it closes when my app exits.”
5 new skills a week. 1 minute to read.
How it works
The agent uses the new .NET 11 process methods that handle waiting and output capture, and sets the lifetime options you ask for.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Process API Improvements — .NET 11
New APIs added to System.Diagnostics.Process in .NET 11 simplify process management, eliminate boilerplate, and prevent common deadlock patterns when capturing output in .NET 11 or later applications.
When to Use
- Running or orchestrating external processes in a .NET 11 (or later) project.
- Needing to start a process, wait for it to exit, and capture its output/error streams without risking deadlocks (
Process.RunAndCaptureText[Async]). - Wanting to ensure child processes are automatically terminated when the parent process exits (
KillOnParentExit). - Requiring lightweight, low-overhead process creation via
SafeProcessHandleon supported platforms. - Requiring fine-grained control over handle inheritance (
InheritedHandles) or starting detached processes (StartDetached).
When Not to Use
- The project targets .NET 10 or earlier — these APIs are not available before .NET 11.
- The default
Process.Start()is sufficient and does not require output capturing or advanced lifecycle rules.
Target Framework
<TargetFramework>net11.0</TargetFramework>
New APIs
Types
Before using the new convenience methods, note the following types. Use the framework types directly:
| Type | Kind | Read-only properties |
|---|---|---|
ProcessExitStatus |
Sealed class | int ExitCode, bool Canceled, PosixSignal? Signal |
ProcessTextOutput |
Sealed class | ProcessExitStatus ExitStatus, string StandardOutput, string StandardError, int ProcessId |
ProcessOutputLine |
Readonly struct | string Content, bool StandardError |
ProcessExitStatus describes the outcome of a completed process. Interpret ExitCode using the external command's contract; there is no universal Success property. ProcessTextOutput contains the exit status, captured output and error text, and process ID. ProcessOutputLine identifies one output line and whether it came from standard error.
High-Level Convenience APIs
Static Methods
The ProcessStartInfo overloads below require UseShellExecute = false, which is the default for .NET.
Process.Run / Process.RunAsync
Starts a process and waits for it to exit, returning the exit status. Does not capture standard output or error. Passing silent: true discards standard output and error by internally redirecting standard handles to the NUL device. On timeout or cancellation, the process is killed.
public static ProcessExitStatus Run(string fileName, IEnumerable<string>? arguments = null, bool silent = false, TimeSpan? timeout = null)
public static Task<ProcessExitStatus> RunAsync(string fileName, IEnumerable<string>? arguments = null, bool silent = false, CancellationToken cancellationToken = default)
public static ProcessExitStatus Run(ProcessStartInfo startInfo, TimeSpan? timeout = null)
public static Task<ProcessExitStatus> RunAsync(ProcessStartInfo startInfo, CancellationToken cancellationToken = default)
Process.RunAndCaptureText / Process.RunAndCaptureTextAsync
Starts a process, captures both standard output and error, and waits for it to exit. Extremely useful for avoiding deadlocks on stream redirection. On timeout or cancellation, the process is killed.
When using the ProcessStartInfo overloads, the caller is responsible for setting RedirectStandardOutput = true and RedirectStandardError = true on ProcessStartInfo (because BCL APIs cannot modify the input arguments they were given).
public static ProcessTextOutput RunAndCaptureText(string fileName, IEnumerable<string>? arguments = null, TimeSpan? timeout = null)
public static Task<ProcessTextOutput> RunAndCaptureTextAsync(string fileName, IEnumerable<string>? arguments = null, CancellationToken cancellationToken = default)
public static ProcessTextOutput RunAndCaptureText(ProcessStartInfo startInfo, TimeSpan? timeout = null)
public static Task<ProcessTextOutput> RunAndCaptureTextAsync(ProcessStartInfo startInfo, CancellationToken cancellationToken = default)
Process.StartAndForget
There is a common misconception that when a process is disposed, it's also being killed. This is not the case, as Process.Dispose only releases the resources associated with the process, but does not kill it.
To make it easier to start a process without the need to worry about disposing it, Process.StartAndForget was introduced. The method starts an executable, retu
FAQ
Does it work on .NET 10?
No. These APIs exist only in .NET 11 and later.
Does the default Process.Start still work?
Yes. The default is fine when you do not need output capture or the new lifetime rules.
What does KillOnParentExit do?
It makes child processes stop automatically when the parent process ends.
Details
Original description by the author
Provides guidance on the new System.Diagnostics.Process APIs introduced in .NET 11: Process.Run, Process.RunAndCaptureText, Process.StartAndForget, Process.ReadAllText/Bytes/Lines, KillOnParentExit, InheritedHandles, and StartDetached. USE FOR: starting, orchestrating, or capturing output from external processes in applications targeting net11.0 or later. DO NOT USE FOR: applications targeting .NET 10 or earlier, or basic pre-.NET 11 Process.Start usage without new APIs.
repo: dotnet/skills
Popularity
- GitHub stars
- 5.8k
- Ranking position
- #14655
- License
- MIT
- Updated
- 11/2/2026
Comments
- …
More skills from this repository
create-custom-agent
5.8kHelps your agent create VS Code custom agent files with their own tools, instructions and handoffs to other agents.
create-skill
5.8kHelps your agent create a new agent skill with a valid name, a clear trigger description and a SKILL.md file that follows the standard.
csharp-scripts
5.8kHelps your agent run a small C# program as a single file with the .NET command line tool, without creating a full project.
dotnet-pinvoke
5.8kHelps your agent call native C or C++ libraries from .NET correctly, covering signatures, string handling, memory and safe handles.
Similar skills
api-connector-builder
280kHas your agent build new API connections following the existing pattern. Use when you need to add one more integration without creating a new way of doing things.
api-design
280kHelps your agent design REST APIs following best practices. It's useful for defining how APIs communicate, how errors are shown, and how to organize data.
backend-patterns
280kHelps your agent with server-side architecture patterns and database optimization. It's useful for building or reviewing code that runs on the server.