-
Notifications
You must be signed in to change notification settings - Fork 12
CLI User Guide
As many other tools CS-Script provides an intensive command line interface that can be used from shell/terminal (e.g. Bash, PowerShell, command-prompt). This interface is particularly useful fo environments like Linux, where working from terminal is a predominate development approach.
CS-Script deployment model exist in two distinctive distribution forms:
-
Simple
Applicable for Windows, Linux, Mac. Basically it is an XCopy approach when yuo can bring on the target system CS-Script binaries that you need. Typically it is the script engine executable (cscs.exe). While you may also want to bring CSSRoslynProvider.dll along but strictly speaking cscs.exe is all you need ro run C# scripts. -
Complete
Applicable for Windows only. This model involves much dipper integration with the host OS. It involves bringing the software package (7z archive) from GitHub Releases folder unpacking it and launching the config console (css_config.exe), which performs all necessary configuration steps. Alternatively you can perform a single step deployment via the Chocolatey CS-Script package. The Complete deployment/distro contains much more than CS-Script binaries (Simple distro). It also includes extra utilities and binaries targeting various rintimes and the documentation.Full distro content (click to expand)
- Integration with OS: system path, envars, shell-extensions, default editor association
- GUI configuration console
- NuGet and Wsdl third-party tools
- Collection of utility scripts
- Binaries targeting legacy runtimes (e.g. .NET 3.5)
- Complete set of Roslyn binaries
- Intensive _Samples_ library
- Documentation
While Complete distro contains many useful resources the Simple one is what you would need in 90% of the cases. The script engine CLI is designed in such a way that it (single executable) can produce the minimal set of CS-Script documentation, samples and required configuration. The Simple distro is applicable for all OSs and as such it is perfect as a basic environment for a crash-course in CS-Script.
Note, if you are running CS-Script on Mono you will always need to supply the mono
prefix for all commands: mono cscs.exe -ver
instead of cscs -ver
. However this contains all samples written in the short form for teh sake of simplicity.
Create and execute sample script
-
cscs -s
- prints sample script. -
cscs -s > sample.cs
- redirects sample script content into sample.cs file -
cscs sample.cs
- execute sample.cs file
Hints and tips
-
You can print the list of all supported commands with
cscs -cmd
-
You can access help for a specific command by typing
?
after the command (e.g.cscs -syntax -?
) -
You can print the whole overview of CS-Script specific C# directives with
cscs -syntax
-
The most common/useful CS-Script directives for C# scripts are:
-
//css_ref *
- reference assembly -
//css_inc *
- include/import another script -
//css_nuget *
- reference nuget package
-
Note, this section does not cover the whole CLI but only highlights its most important elements. The whole CLI documentation can be generated with cscs -?
command. You can also access its latest copy here.
Command: version
Syntax: cscs -ver
(or just cscs
)
Description: Prints full information about the current CS-Script environment.
Command: commands
Syntax: cscs -cmd
Description: Prints list of supported commands (arguments).
Syntax: cscs -cmd ?
Description: Prints description of an individual command.
Under development