⊙ A .NET library for describing and running targets and their dependencies.
Latest commit 8aefc7d Dec 9, 2018



NuGet version Build status Build Status

Bullseye is a .NET library for describing and running targets and their dependencies.

Bullseye targets can do anything. They are not restricted to building .NET projects.

Platform support: .NET Standard 2.0 and upwards.

Quick start

  • Install the .NET Core SDK.
  • In a console:
    mkdir targets
    cd targets
    dotnet new console
    dotnet add package Bullseye
  • Using your favourite text editor or IDE, replace the contents of Program.cs with:
    using static Bullseye.Targets;
    class Program
        static void Main(string[] args)
            Target("default", () => System.Console.WriteLine("Hello, world!"));
  • Back in your console:
    dotnet run
  • For help:
    dotnet run -- --help

Also see the async quick start.

Defining dependencies

Target("default", DependsOn("drink-tea", "walk-dog"));
Target("make-tea", () => Console.WriteLine("Tea made."));
Target("drink-tea", DependsOn("make-tea"), () => Console.WriteLine("Ahh... lovely!"));
Target("walk-dog", () => Console.WriteLine("Walkies!"));

Enumerable inputs

    ForEach("digestives", "chocolate hob nobs"),
    biscuits => Console.WriteLine($"Mmm...{biscuits}! Nom nom."));

Sample wrapper scripts

  • build.cmd
@echo Off
dotnet run --project targets -- %*
  • build.sh
#!/usr/bin/env bash
set -euo pipefail
dotnet run --project targets -- "$@"
  • build.ps1
$ErrorActionPreference = "Stop";
dotnet run --project targets -- $args

Command line arguments

Generally, all the command line arguments passed to Program.cs should be passed along to Bullseye, as shown in the quick start above (RunTargetsAndExit(args);). This is because Bullseye effectively provides a command line interface, with options for displaying a list of targets, performing dry runs, suppressing colour, and more. For full details of the command line options, run your targets project supplying the --help (-h/-?) option:

dotnet run --project targets -- --help
./build.cmd --help
./build.sh -h
./build.ps1 -?

You can also handle custom arguments in Program.cs, but you should ensure that only valid arguments are passed along to Bullseye. A good way to do this is to use McMaster.Extensions.CommandLineUtils to parse your custom arguments, and pass the remaining arguments to Bullseye. See this gist as an example.

Who's using Bullseye?

To name a few:

Feel free to send a pull request to add your repo or organisation to this list!

Target by Franck Juncker from the Noun Project.