Skip to content
⊙ A .NET library for describing and running targets and their dependencies.
Branch: master
Clone or download
Latest commit 1d3115b Jul 16, 2019


NuGet version Appveyor build status Azure DevOps build status GitLab build status Travis CI 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 -- %*
#!/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
./ -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.


Can I force a pause before exiting when debugging in Visual Studio 2017 (or earlier)?

Yes! Add the following line anywhere before calling RunTargetsAndExit/RunTargetsAndExitAsync:

AppDomain.CurrentDomain.ProcessExit += (s, e) => Console.ReadKey();

Note that the common way to do this for .NET console apps is to add a line such as the following before the end of the Program.Main method:


This does not work after calling RunTargetsAndExit/RunTargetsAndExit because that is the final statement that will be executed.

In Visual Studio 2019 and later, .NET console apps pause before exiting by default, so none of this is required.

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.

You can’t perform that action at this time.