bwets.Sharpliner.Extensions 0.1.4

dotnet add package bwets.Sharpliner.Extensions --version 0.1.4
                    
NuGet\Install-Package bwets.Sharpliner.Extensions -Version 0.1.4
                    
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="bwets.Sharpliner.Extensions" Version="0.1.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="bwets.Sharpliner.Extensions" Version="0.1.4" />
                    
Directory.Packages.props
<PackageReference Include="bwets.Sharpliner.Extensions" />
                    
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 bwets.Sharpliner.Extensions --version 0.1.4
                    
#r "nuget: bwets.Sharpliner.Extensions, 0.1.4"
                    
#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 bwets.Sharpliner.Extensions@0.1.4
                    
#: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=bwets.Sharpliner.Extensions&version=0.1.4
                    
Install as a Cake Addin
#tool nuget:?package=bwets.Sharpliner.Extensions&version=0.1.4
                    
Install as a Cake Tool

bwets.Sharpliner.Extensions

Reusable, domain-free building blocks for authoring Azure DevOps pipelines with Sharpliner. Sharpliner lets you write pipelines as C# instead of YAML; this library adds the ergonomics that make a large, strongly-typed pipeline codebase pleasant to write, read, and refactor:

  • Typed template bases so each template has a plain-POCO parameter model, a typed Reference() call-site factory, and compile-time-safe P(p => p.X) parameter references.
  • A parameter mapper that turns a POCO into an Azure DevOps parameters: block.
  • Expression helpers for the compile-time functions (coalesce, format, ${{ each }} loops, …).
  • Typed variables that both declare themselves and hand out typed references.
  • Conditional mapping-key records for the ${{ if … }}: key: idiom Sharpliner can't otherwise model.
  • 157 typed marketplace-task records generated from the official task.json definitions — every input is a typed property, and inputs with a closed allowed-value list become enums.

Everything here is generic. It carries no assumptions about any particular repository, naming convention, or product.

Install

dotnet add package bwets.Sharpliner.Extensions

Targets net10.0 and brings in Sharpliner transitively.

30-second example

using bwets.Sharpliner.Extensions;
using bwets.Sharpliner.Extensions.Tasks;
using Sharpliner;
using Sharpliner.AzureDevOps;
using Sharpliner.AzureDevOps.Expressions;

public sealed class InstallDotNetParameters
{
    public string? Version { get; init; }                              // required (no default)
    [Default("$(Agent.ToolsDirectory)/dotnet")] public string? InstallPath { get; init; }
}

public class InstallDotNet : TypedStepTemplate<InstallDotNet, InstallDotNetParameters>
{
    public override TargetPathType TargetPathType => TargetPathType.RelativeToGitRoot;
    public override string TargetFile => "pipelines/install-dotnet.yml";

    public override AdoExpressionList<Step> Definition =>
    [
        new UseDotNetTask("Install .NET SDK")
        {
            PackageType = UseDotNetPackageType.Sdk,     // typed enum from UseDotNet@2's task.json
            Version = P(p => p.Version),                // ${{ parameters.version }}
            InstallationPath = P(p => p.InstallPath),
        },
    ];
}

generates

parameters:
- name: version
  type: string

- name: installPath
  type: string
  default: $(Agent.ToolsDirectory)/dotnet

steps:
- task: UseDotNet@2
  displayName: Install .NET SDK
  inputs:
    packageType: sdk
    version: ${{ parameters.version }}
    installationPath: ${{ parameters.installPath }}

and another template consumes it with a compile-checked call site:

InstallDotNet.Reference(new() { Version = P(p => p.DotNetVersion) })

Documentation

Guide What it covers
Getting started Install, the pieces, your first template + pipeline
Typed templates TypedStepTemplate/Job/Stage/VariableTemplate/Pipeline, Reference(), P()
Parameters POCO → parameters: mapping, [Default]/[ParamName]/[AllowedValues]/EmptyDefault, AdoValue<T>, ConditionalValue
Expressions Expr, ExprNode, LoopItem and ${{ each }} loops
Variables TypedVariable and its .Ref/.Compile/.Macro references
Conditional mapping keys ConditionalPoolStage/Job, ConditionalContainerJob, NamedPool, ConditionalVariablesBlock
Typed task records The 157 Tasks/ records and their input enums

Samples

Runnable, compiled examples live in samples/ — a project that builds four progressive definitions (step → job → stage → pipeline) and publishes their YAML to samples/generated/ so the input C# and output YAML always stay in sync.

How it relates to Sharpliner

This is a pure add-on: every type here builds on Sharpliner's model (StepTemplateDefinition, Stage, Job, AzureDevOpsTask, …) and produces ordinary Sharpliner definitions. You can mix these helpers with plain Sharpliner freely, and drop down to raw Sharpliner any time.

License

MIT

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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.4 54 7/3/2026
0.1.3 51 7/3/2026
0.1.2 55 7/3/2026
0.1.0 51 7/3/2026