Skip to content

Getting Started

Scott Singleton edited this page May 11, 2026 · 5 revisions

Getting Started

5 minutes from zero to running your first target.

Prerequisites

  • A supported .NET SDK installed: .NET 8, 9, or 10. Tamp's first-party packages multi-target all three; pick whichever is on your dev machine. (See ADR 0015 for why.)
  • git (for repository discovery — Tamp walks up looking for .git to find the project root).

Step 1 — install the global tool

Two flavors. Pick one based on how you'd rather invoke Tamp:

# Bare command — type `tamp ci` (NUKE-style)
dotnet tool install -g Tamp.Cli

# dotnet-verb command — type `dotnet tamp ci` (Cake-style)
dotnet tool install -g dotnet-tamp

Both ship the same code; only the on-PATH command name differs. You can install both if you want both.

Step 2 — create a build project

Tamp builds are regular .NET console projects. The convention is to put yours under build/ at the repo root:

mkdir -p build
cd build
dotnet new console -n Build -o .

Edit build/Build.csproj to reference Tamp:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net10.0</TargetFramework>
    <Nullable>enable</Nullable>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Tamp.Core" Version="0.0.1-alpha" />
    <PackageReference Include="Tamp.NetCli.V10" Version="0.0.1-alpha" />
  </ItemGroup>
</Project>

Note on versions: 0.0.1-alpha is the current pre-launch placeholder. The first stable release will use a real version; check the changelog for what to pin.

Step 3 — write your first target

Replace the contents of build/Program.cs with a minimal Build.cs:

using Tamp;
using Tamp.NetCli.V10;

class Build : TampBuild
{
    public static int Main(string[] args) => Execute<Build>(args);

    [Parameter("Build configuration")]
    Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release;

    Target Compile => _ => _
        .Description("Restore + build the solution")
        .Executes(() => DotNet.Build(s => s
            .SetConfiguration(Configuration)));

    Target Default => _ => _
        .Default()
        .DependsOn(nameof(Compile));
}

That's a complete build script. Five elements doing the work:

  1. class Build : TampBuild — your build inherits the framework's entry point and statics.
  2. Execute<Build>(args) — the framework's Main shim. Reflects over your class, builds the target graph, parses args, dispatches.
  3. [Parameter] on Configuration — auto-bound from --configuration <value> on the CLI or the CONFIGURATION environment variable, with IsLocalBuild ? Debug : Release as the default.
  4. Target properties — declarative target definitions. Every target is top-level by default in 1.1.0+; mark internal helpers with .Internal(). .Default() on a target makes it the no-args entry point (replaces the legacy "literally-named-Default" convention, which still works as a fallback).
  5. DotNet.Build(...) — typed wrapper that returns a CommandPlan the runner dispatches.

Step 4 — run it

From the repository root:

tamp                       # runs Default → Compile (Debug locally, Release on CI)
tamp Compile               # explicitly named target
tamp Compile --configuration Release   # override the parameter
tamp Compile --dry-run     # print the dotnet build command, execute nothing
tamp --list                # show top-level targets

The output ends with a build summary table:

─── Build Summary ───
  Target    Status   Duration
  Compile   ✓ Done   1.4 s
                     ─────
  Total              1.4 s

Where next

Clone this wiki locally