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
                    
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="Soenneker.Utils.Dotnet" Version="4.0.2598" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Utils.Dotnet" Version="4.0.2598" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Utils.Dotnet" />
                    
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 Soenneker.Utils.Dotnet --version 4.0.2598
                    
#r "nuget: Soenneker.Utils.Dotnet, 4.0.2598"
                    
#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 Soenneker.Utils.Dotnet@4.0.2598
                    
#: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=Soenneker.Utils.Dotnet&version=4.0.2598
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Utils.Dotnet&version=4.0.2598
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
Loading failed

Updated Multiple NuGet packages