Sponsor: Using RabbitMQ or Azure Service Bus in your .NET systems? Well, you could just use their SDKs and roll your own serialization, routing, outbox, retries, and telemetry. I mean, seriously, how hard could it be?
How many times have you created a console application to run specific tasks in .NET? These tasks could be processing a file, making some HTTP call to an external service or even helping in your build process. Ultimately ending up with a collection of different tasks which often have dependencies on each other.
I just discovered a project called Bullseye by Adam Ralph which really feels like a simple task runner. But better yet, is just a library you add to your own console application and not its own process itself.
Bullseye
Bullseye is a .NET package for describing and running targets and their dependencies.
Bullseye can be used to write targets that do anything. It is not coupled to building .NET projects.
Platform support: .NET Standard 1.3 and upwards.
Examples
The simplest example which is described on the Bullseye readme is similar to as follows:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There’s really only two components needed. Define your target(s) using the Target() methods and then specify which targets to run via RunTargets()
If you do not specify a target to run then the “default” target is used.
If you simply run dotnet run will produce the output:
This would have been the equivalent of running dotnet run default
Dependencies
Here’s a simple example of having one target depend on another. In one target I’m hitting a service to get the exchange rate from CAD to USD. In another, I want to save that rate to a file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters