C# interactive build automation system makes it easy to build .NET projects. It can be part of your solution as a regular console cross-platform .NET application, run C# scripts without compiling them, or even run in REPL mode - allowing you to run C# interactively.
- 3 compatible operating modes
- Cross-platform
- Debugging capability
- No model limitations (Task, Target, DependsOn, etc.)
- Regular .NET code
- Best programming practices
- Powerful API for building .NET projects
- Summarised statistics
These modes are practically compatible, i.e., for example, a script can be run as a .NET project, and vice versa, with minimal or no changes.
Please see this page for installation details.
Launch the tool in the interactive mode:
dotnet csi
Simply enter C# commands sequentially one line after another and get the result in console output.
Run a specified script with a given argument:
dotnet csi ./MyDirectory/hello.csx World
Run a single script located in the MyDirectory directory:
dotnet csi ./MyDirectory World
Usage details
dotnet csi [options] [--] [script] [script arguments]
Executes a script if specified, otherwise launches an interactive REPL (Read Eval Print Loop).
--
- Indicates that the remaining arguments should not be treated as options.
script
- The path to the script file to run. If no such file is found, the command will treat it as a directory and look for a single script file inside that directory.
script arguments
- Script arguments are accessible in a script via the global list Args[index]
by an argument index.
@file
- Read the response file for more options.
Supported options:
Option | Description | Alternative form |
---|---|---|
--help | Show how to use the command. | /? , -h , /h , /help |
--version | Display the tool version. | /version |
--source | Specify the NuGet package source to use. Supported formats: URL, or a UNC directory path. | -s , /s , /source |
--property <key=value> | Define a key-value pair(s) for the script properties called Props, which is accessible in scripts. | -p , /property , /p |
--property:<key=value> | Define a key-value pair(s) in MSBuild style for the script properties called Props, which is accessible in scripts. | -p:<key=value> , /property:<key=value> , /p:<key=value> , --property:key1=val1;key2=val2 |
Please see this page for details on how to install the project template.
Create a console project Build containing a script from the template build
dotnet new build -o ./Build
The created project contains 2 entry points:
- Program.csx to run as a script
dotnet csi ./Build
- Program.cs to run as .NET application
dotnet run --project ./Build