Soenneker.Utils.Dotnet
4.0.2598
Prefix Reserved
dotnet add package Soenneker.Utils.Dotnet --version 4.0.2598
NuGet\Install-Package Soenneker.Utils.Dotnet -Version 4.0.2598
<PackageReference Include="Soenneker.Utils.Dotnet" Version="4.0.2598" />
<PackageVersion Include="Soenneker.Utils.Dotnet" Version="4.0.2598" />
<PackageReference Include="Soenneker.Utils.Dotnet" />
paket add Soenneker.Utils.Dotnet --version 4.0.2598
#r "nuget: Soenneker.Utils.Dotnet, 4.0.2598"
#:package Soenneker.Utils.Dotnet@4.0.2598
#addin nuget:?package=Soenneker.Utils.Dotnet&version=4.0.2598
#tool nuget:?package=Soenneker.Utils.Dotnet&version=4.0.2598
Soenneker.Utils.Dotnet
DI-friendly wrappers around the dotnet CLI for restore, build, run, test, pack, clean, and NuGet package operations.
Installation
dotnet add package Soenneker.Utils.Dotnet
Registration
builder.Services.AddDotnetUtilAsSingleton();
Scoped registration is also available with AddDotnetUtilAsScoped().
Build workflow
bool restored = await dotnet.Restore(solutionPath, cancellationToken: cancellationToken);
bool built = restored && await dotnet.Build(
solutionPath,
configuration: "Release",
restore: false,
cancellationToken: cancellationToken);
bool packed = built && await dotnet.Pack(
projectPath,
version: "1.2.3",
build: false,
restore: false,
output: packageDirectory,
cancellationToken: cancellationToken);
The typed command methods return false when the CLI cannot be started or exits unsuccessfully. Cancellation remains cancellation and throws OperationCanceledException; it is not converted to false.
Execute(arguments) accepts the complete raw argument string after dotnet and returns captured output. Use it only with arguments assembled from trusted values. Prefer the typed methods when user-controlled paths or options are involved.
Run an application
Run() waits for dotnet run to exit:
bool succeeded = await dotnet.Run(
projectPath,
configuration: "Release",
applicationArguments: ["--import", inputPath],
cancellationToken: cancellationToken);
Start() returns after launching a long-running process:
using Process? process = await dotnet.Start(
projectPath,
outputCallback: line => logger.LogInformation("{Line}", line),
errorCallback: line => logger.LogError("{Line}", line),
cancellationToken: stoppingToken);
Cancelling the token supplied to Start() kills the launched process tree. The caller owns the returned Process and should dispose it. A null result means path validation or process startup failed; it does not mean the launched application later exited successfully.
Package inspection and updates
List<KeyValuePair<string, string>> outdated = await dotnet.ListPackages(
projectPath,
outdated: true,
cancellationToken: cancellationToken);
bool updated = await dotnet.UpdatePackages(repositoryPath, cancellationToken: cancellationToken);
UpdatePackages() finds project files recursively, restores the path, updates each outdated top-level package, and restores again. It edits project files incrementally and does not roll back earlier updates when a later package or final restore fails. Run it in a clean, version-controlled working tree when those mutations need review or recovery.
The utility sets the CLI language to English, disables telemetry, and suppresses the .NET logo so package-list JSON and captured output remain predictable.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. |
-
net10.0
- Soenneker.Utils.Directory (>= 4.0.944)
- Soenneker.Utils.File (>= 4.0.2280)
- Soenneker.Utils.Process (>= 4.0.1567)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Soenneker.Utils.Dotnet:
| Package | Downloads |
|---|---|
|
Soenneker.Utils.Dotnet.NuGet
A utility library for dotnet NuGet operations |
|
|
Soenneker.Playwrights.TestEnvironment
A test environment for testing with Playwright |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.2598 | 219 | 9/17/2026 |
| 4.0.2597 | 353 | 9/16/2026 |
| 4.0.2596 | 209 | 9/16/2026 |
| 4.0.2595 | 45 | 9/16/2026 |
| 4.0.2594 | 926 | 9/16/2026 |
| 4.0.2592 | 161 | 9/15/2026 |
| 4.0.2591 | 6,562 | 9/13/2026 |
| 4.0.2589 | 1,233 | 9/13/2026 |
| 4.0.2588 | 88 | 9/13/2026 |
| 4.0.2587 | 83 | 9/13/2026 |
| 4.0.2586 | 808 | 9/12/2026 |
| 4.0.2585 | 89 | 9/12/2026 |
| 4.0.2584 | 1,573 | 9/12/2026 |
| 4.0.2582 | 111 | 9/12/2026 |
| 4.0.2581 | 5,203 | 9/10/2026 |
| 4.0.2580 | 1,081 | 9/9/2026 |
| 4.0.2579 | 174 | 9/9/2026 |
| 4.0.2578 | 357 | 9/9/2026 |
| 4.0.2577 | 91 | 9/9/2026 |
| 4.0.2576 | 1,511 | 9/9/2026 |
Updated Multiple NuGet packages