⊙ A minimalist target runner for C# scripts.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
assets
src
tests
.editorconfig
.gitattributes
.gitignore
CODEOWNERS
LICENSE
README.md
appveyor.yml
build.cmd
packages.config

README.md

This project has been replaced by Bullseye. It is recommended to migrate your targets from simple-targets-csx to Bullseye.

This project is no longer maintained. If you would like to take it over, please raise an issue or contact the owners of the NuGet package via the NuGet gallery.

Icon

simple-targets-csx

NuGet version Build status

A minimalist C# script library for writing targets for building, analysing, testing, packaging, deploying, etc. and running them using any runner which supports the "standard" C# script dialect (as defined by csi.exe).

In no way restricted to writing targets related to .NET projects.

Quickstart

  • Install (or download and unzip) the NuGet package.
  • Create a C# script named build.csx and add the following code:
#load "packages/simple-targets-csx.6.0.0/contentFiles/csx/any/simple-targets.csx" // change the path as required

using static SimpleTargets;

var targets = new TargetDictionary();

targets.Add("default", () => Console.WriteLine("Hello, world!"));

Run(Args, targets);

Usage

Action Command
Run a specific target {runner} .\build.csx targetname
Run multiple targets {runner} .\build.csx target1name target2name
List targets {runner} .\build.csx -T
List targets and dependencies {runner} .\build.csx -D
Dry run Append -n, e.g. {runner} .\build.csx -n or {runner} .\build.csx targetname -n
Skip running dependencies Append -s, e.g. {runner} .\build.csx -s or {runner} .\build.csx targetname -s
Show full usage details {runner} .\build.csx -?

Runners

  • csi.exe - Microsoft's "C# REPL Command-Line Interface". This is bundled with MSBuild 14 (and Visual Studio 2015) onwards so it's a good choice if you are using simple-targets-csx to write a build script for a .NET project, since the project will already likely have a dependency on MSBuild.
  • Dude - the portable C# script runner (csi.exe conveniently repackaged as a single self-contained exe). This is a good choice if you don't want or need to have a dependency on MSBuild. dude.exe can easily be downloaded and cached by a bootstrap command (similar to NuGet.exe in the example below).

Other C# script runners such as dotnet-script should also work.

Examples

xBehave.net uses a bootstrap command to

  • Download and cache NuGet.exe
  • Restore NuGet packages (including simple-targets-csx)
  • Execute its build script using csi.exe

Target by Franck Juncker from the Noun Project.