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
projectPathRootedPathThe full path to the project file (e.g., "src/MyWebApp/MyWebApp.csproj").
optionsDotnetPublishAndStageOptionsOptional. Configuration options for the publishing and staging process.
cancellationTokenCancellationTokenA 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:
- Determines the output directory for the published application.
- Cleans up existing publish directories if specified.
-
Applies version transformations to project files if
SetVersionsFromProviders is
true. - Executes the `dotnet publish` command using Publish(RootedPath, DotnetPublishOptions?, ProcessRunOptions?, CancellationToken) .
- 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
projectNamestringThe name of the project to publish (e.g., "MyWebApp").
optionsDotnetPublishAndStageOptionsOptional. Configuration options for the publishing and staging process.
cancellationTokenCancellationTokenA 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.