Table of Contents

Interface IDotnetPublishHelper

Namespace
Invex.Atom.Module.Dotnet.Helpers
Assembly
Invex.Atom.Module.Dotnet.dll

Provides helper methods for publishing .NET projects and staging their output.

public interface IDotnetPublishHelper : IDotnetCliHelper, IBuildInfo, IBuildAccessor
Inherited Members

Remarks

This interface extends IDotnetCliHelper to utilize the .NET CLI for publishing operations and IBuildInfo to leverage build version information.

Methods

DotnetPublishAndStage(RootedPath, DotnetPublishAndStageOptions?, CancellationToken)

Publishes a .NET project specified by its path and stages the output.

Task DotnetPublishAndStage(RootedPath projectPath, DotnetPublishAndStageOptions? options = null, CancellationToken cancellationToken = default)

Parameters

projectPath RootedPath

The full path to the project file (e.g., "src/MyWebApp/MyWebApp.csproj").

options DotnetPublishAndStageOptions

Optional. Configuration options for the publishing and staging process.

cancellationToken CancellationToken

A cancellation token to observe while waiting for the task to complete.

Returns

Task

A System.Threading.Tasks.Task representing the asynchronous operation.

Remarks

This method performs the following steps:

  1. Determines the output directory for the published application.
  2. Cleans up existing publish directories if specified.
  3. Applies version transformations to project files if SetVersionsFromProviders is true.
  4. Executes the `dotnet publish` command using Publish(RootedPath, DotnetPublishOptions?, ProcessRunOptions?, CancellationToken) .
  5. Moves the published output to the Atom publish directory for the project.

The BuildVersion is used for version transformation.

DotnetPublishAndStage(string, DotnetPublishAndStageOptions?, CancellationToken)

Publishes a .NET project by its name and stages the output.

Task DotnetPublishAndStage(string projectName, DotnetPublishAndStageOptions? options = null, CancellationToken cancellationToken = default)

Parameters

projectName string

The name of the project to publish (e.g., "MyWebApp").

options DotnetPublishAndStageOptions

Optional. Configuration options for the publishing and staging process.

cancellationToken CancellationToken

A cancellation token to observe while waiting for the task to complete.

Returns

Task

A System.Threading.Tasks.Task representing the asynchronous operation.

Remarks

This method first locates the project file based on its name, then calls DotnetPublishAndStage(RootedPath, DotnetPublishAndStageOptions?, CancellationToken) with the resolved path.

Exceptions

StepFailedException

Thrown if the project file cannot be located.