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
- Defining dependencies
- Enumerable inputs
- Sample wrapper scripts
- Command line arguments
- FAQ
- Who's using Bullseye?
- 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!")); RunTargetsAndExit(args); } }
- Back in your console:
dotnet run
- For help:
dotnet run -- --help
Also see the async quick start.
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!"));
Target(
"eat-biscuits",
ForEach("digestives", "chocolate hob nobs"),
biscuits => Console.WriteLine($"Mmm...{biscuits}! Nom nom."));
dotnet run -- eat-biscuits
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
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 a command line parsing package to parse your custom arguments, and pass any unrecognised arguments to Bullseye. For example:
- Using System.CommandLine.Experimental, you can pass the unmatched tokens to Bullseye. See this gist as an example.
- Using McMaster.Extensions.CommandLineUtils, you can pass the remaining arguments to Bullseye. See this gist as an example.
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:
Console.ReadKey();
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.
To name a few:
- AspNetCore.AsyncInitialization
- Config.SqlStreamStore
- ConfigR
- Elasticsearch.Net & NEST
- EssentialMVVM
- FakeItEasy
- HumanBytes
- Ibento
- IdentityModel
- IdentityServer
- Iso8601DurationHelper
- Linq.Extras
- LiteGuard
- LittleForker
- LykkeOSS
- Marten
- MinVer
- Particular
- ProxyKit
- PseudoLocalizer
- Radical Framework
- SelfInitializingFakes
- SendComics
- SqlStreamStore.Locking
- SQLStreamStore
- Statik
- TemplatedConfiguration
- xBehave.net
Feel free to send a pull request to add your repo or organisation to this list!
Target by Franck Juncker from the Noun Project.