Table of Contents

Class DotnetOperations

Namespace
Ando.Operations
Assembly
ando.dll

Provides .NET CLI operations for build scripts. Methods register steps in the workflow rather than executing immediately.

public class DotnetOperations : OperationsBase
Inheritance
DotnetOperations
Inherited Members

Constructors

DotnetOperations(StepRegistry, IBuildLogger, Func<ICommandExecutor>, DotnetSdkEnsurer?)

Provides .NET CLI operations for build scripts. Methods register steps in the workflow rather than executing immediately.

public DotnetOperations(StepRegistry registry, IBuildLogger logger, Func<ICommandExecutor> executorFactory, DotnetSdkEnsurer? sdkEnsurer = null)

Parameters

registry StepRegistry
logger IBuildLogger
executorFactory Func<ICommandExecutor>
sdkEnsurer DotnetSdkEnsurer

Methods

Build(ProjectRef, Action<DotnetBuildOptions>?)

Registers a 'dotnet build' step to compile the project.

public void Build(ProjectRef project, Action<DotnetBuildOptions>? configure = null)

Parameters

project ProjectRef
configure Action<DotnetBuildOptions>

Project(string)

Creates a .NET project reference from a path. Usage: var app = Dotnet.Project("./src/MyApp/MyApp.csproj");

public ProjectRef Project(string path)

Parameters

path string

Path to the .csproj file.

Returns

ProjectRef

Publish(ProjectRef, Action<DotnetPublishOptions>?)

Registers a 'dotnet publish' step to create deployment artifacts.

public void Publish(ProjectRef project, Action<DotnetPublishOptions>? configure = null)

Parameters

project ProjectRef
configure Action<DotnetPublishOptions>

Restore(ProjectRef, Action<DotnetRestoreOptions>?)

Registers a 'dotnet restore' step to restore NuGet packages.

public void Restore(ProjectRef project, Action<DotnetRestoreOptions>? configure = null)

Parameters

project ProjectRef
configure Action<DotnetRestoreOptions>

SdkInstall(string)

Installs .NET SDK globally using Microsoft's install script. Use this when building in a base image that doesn't have .NET pre-installed. Calling this method disables automatic SDK installation for subsequent operations.

public void SdkInstall(string version = "9.0")

Parameters

version string

SDK version (e.g., "9.0", "8.0"). Defaults to "9.0".

Test(ProjectRef, Action<DotnetTestOptions>?)

Registers a 'dotnet test' step to run unit tests.

public void Test(ProjectRef project, Action<DotnetTestOptions>? configure = null)

Parameters

project ProjectRef
configure Action<DotnetTestOptions>

Tool(string, string?)

Creates a reference to a .NET CLI tool for installation.

public DotnetTool Tool(string packageId, string? version = null)

Parameters

packageId string

NuGet package ID of the tool.

version string

Optional specific version.

Returns

DotnetTool