https://github.com/adamralph/simple-targets-csx
⊙ A minimalist target runner for C# scripts.
https://github.com/adamralph/simple-targets-csx
build csharp csi csx csx-script dotnet task-runner
Last synced: 5 months ago
JSON representation
⊙ A minimalist target runner for C# scripts.
- Host: GitHub
- URL: https://github.com/adamralph/simple-targets-csx
- Owner: adamralph
- License: mit
- Archived: true
- Created: 2016-09-25T22:25:41.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2021-02-28T18:36:37.000Z (over 5 years ago)
- Last Synced: 2025-08-01T04:55:10.287Z (11 months ago)
- Topics: build, csharp, csi, csx, csx-script, dotnet, task-runner
- Language: C#
- Homepage:
- Size: 143 KB
- Stars: 18
- Watchers: 5
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
**This project has been replaced by [Bullseye](https://github.com/adamralph/bullseye). It is recommended to migrate your targets from simple-targets-csx to Bullseye.**

# simple-targets-csx
[](https://www.nuget.org/packages/simple-targets-csx) [](https://ci.appveyor.com/project/adamralph/simple-targets-csharp/branch/master)
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](https://msdn.microsoft.com/en-us/magazine/mt614271.aspx)).
In no way restricted to writing targets related to .NET projects.
### Quickstart
* Install (or download and unzip) the [NuGet package](https://www.nuget.org/packages/simple-targets-csx).
* Create a C# script named `build.csx` and add the following code:
```C#
#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);
```
* Run `csi.exe .\build.csx` (see ["Runners"](#runners)).
### 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](https://msdn.microsoft.com/en-us/magazine/mt614271.aspx) - 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](https://github.com/adamralph/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](https://github.com/filipw/dotnet-script) should also work.
### Examples
xBehave.net uses a [bootstrap command](https://github.com/xbehave/xbehave.net/blob/dev/build.cmd) to
* Download and cache `NuGet.exe`
* Restore NuGet packages (including simple-targets-csx)
* Execute its [build script](https://github.com/xbehave/xbehave.net/blob/dev/build.csx) using csi.exe
---
[Target](https://thenounproject.com/term/target/345443) by [Franck Juncker](https://thenounproject.com/franckjuncker/) from [the Noun Project](https://thenounproject.com/).