cs-script.cli
4.14.2
See the version list below for details.
dotnet tool install --global cs-script.cli --version 4.14.2
dotnet new tool-manifest
dotnet tool install --local cs-script.cli --version 4.14.2
#tool dotnet:?package=cs-script.cli&version=4.14.2
nuke :add-package cs-script.cli --version 4.14.2
CS-Script (CLI)
CS-Script is a CLR based scripting system which uses ECMA-compliant C# as a programming language.
CS-Script is one of the most mature C# scripting solutions. It became publicly available in 2004, just two years after the first release of .NET. And it was the first comprehensive scripting platform for .NET.
CS-Script allows direct single-step execution of files containing ECMA-compliant C# code (either from shell or from the application).
Canonical "Hello World" script (script.cs):
using System;
Console.WriteLine("Hello World!");
The script can be executed fom the terminal:
css is a native executable. It simply launches the script engine assembly (cscs.dll) without the need to invoke .NET launcher dotnet.
css script.cs
You can read in more details about script engine on the product home page: https://github.com/oleg-shilo/cs-script/wiki/CLI-Script-Execution.
From the start, CS-Script was heavily influenced by Python and the developer experiences it delivers. Thus, it tries to match the most useful Python features (apart from the Python syntax). Here are some highlights of the CS-Script features. - Scripts are written in plain vanilla CLS-compliant C#. Though classless scripts (top-level statements) are also supported. - Remarkable execution speed matching performance of compiled managed applications. - Including (referencing) dependency scripts from the main script. - Referencing external assemblies from the script. - Automatic referencing external assemblies based on analyses of the script-imported namespaces ('usings'). - Automatic resolving (downloading and referencing) NuGet packages. - Building a self-sufficient executable from the script. - Possibility to plug in external compiling services for supporting alternative script syntax (e.g. VB, C++) - Scripts can be executed on Windows, Linux and MacOS (.NET5 needs to be present). - Full integration with Windows, Visual Studio, VSCode, Notepad++ (CS-Script plugin for Notepad++ brings true IntelliSense to the 'peoples editor'), Sublime Text 3
Note, when upgrading or uninstalling CS-Script CLI .NET tool you may need to ensure that you stop any running instances of the script engine. You can do that by executing this simple command: css -servers:stop (or even simpler: css -kill).
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.14.3 | 12 | 3/10/2026 |
| 4.14.2 | 317 | 3/4/2026 |
| 4.14.1 | 78 | 3/4/2026 |
| 4.14.0 | 128 | 3/3/2026 |
| 4.13.1 | 3,252 | 12/20/2025 |
| 4.13.0 | 778 | 12/11/2025 |
| 4.12.0.1 | 1,315 | 11/16/2025 |
| 4.12.0 | 307 | 11/15/2025 |
| 4.11.5 | 941 | 10/28/2025 |
| 4.11.4 | 685 | 10/15/2025 |
| 4.11.3 | 333 | 10/13/2025 |
| 4.11.2 | 487 | 10/7/2025 |
| 4.11.1 | 1,279 | 9/7/2025 |
| 4.11.0 | 1,257 | 8/10/2025 |
| 4.10.1 | 526 | 7/30/2025 |
| 4.10.0 | 221 | 7/29/2025 |
| 4.9.9 | 432 | 7/26/2025 |
| 4.9.8 | 2,117 | 6/9/2025 |
| 4.9.7 | 318 | 6/8/2025 |
| 4.9.6 | 2,148 | 4/27/2025 |
---
## Changes (v4.14.0-4.14.2)
The major changes in this release are around improved support for working with external compile engines in CodeDom evaluator mode. Now both, CLI and CSScriptLib APIs allow automatic download and deployment of the latest .NET compilers (nuget packages) on the target system so the user does not have to install the complete .NET SDK.
Caching and temp files management has also been improved dramatically and made more consistent and reliable.
Another significant change is heave refactoring and documentation improvements.
Special thank you to @maettu-this who helped with the requirements for all these changes.
========================================
### Misc
- #444: "The documentation texts of CompileAssemblyFrom..."
- Updated CodeDom-Evaluator-Dependencies.md to reference the new deployment option.
- Reworked and unified csc.exe probing for CodeDom compilation.
- Intensive code housekeeping
- Major rework of the .NET Framework samples. Triggered by #442
### CLI
- Improved cache cleanup mechanism to prevent endless growth of `csscript.core` directory
- Enabled `Runtime.CleanAbandonedCache()` to automatically remove cache directories when source scripts are deleted
- `-pkill` command improvements. Bump version to 1.0.1
- Added `-deploy-csc` switch for compiler deployment via NuGet
- Enhanced the LockCheck sample to better handle directory lock checks using handle.exe as a fallback.
### CSScriptLib
- #434: Could not load file or assembly 'Microsoft.CodeAnalysis, Version=4.14.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies
- #435: /share compiler flag causes CS2007 error after upgrading to 4.13.1
- #436: SerializationException: Type 'CSScripting.CodeDom.CompilerError' in assembly 'CSScriptLib...
- #437: updated wrong resource referencing.
* #441: Change CodeDomEvaluator.IsCachingEnabled default to true
- #445: Missing information on resulting compilation details?
- #448: Using preprocessor directives with Roslyn / SourceCodeKind.Regular
- #449: RoslynEvaluator ignores disabling referencing AppDomain assemblies.
- #447: Proposing EvaluatorBase.CompileFile for consistency with EvaluatorBase.CompileAssemblyFromFile
Add AttachedProperties and project context to compilation
- Enabled abandoned cache cleanup to prevent endless growth of `csscript.lib` directory
- Cache directories are now automatically cleaned when source script directories no longer exist
- Added NugetPackageDownloader and unified compiler discovery
- Deprecated CompilerLastOutput; add CompilerInput/Output
- Added DownloadLatestSdkToolset to NugetPackageDownloader for automated retrieval of compilers and reference assemblies. It improves support for environments without .NET SDK.
### Temporary Directory Structure
CS-Script now uses separate temporary directories for better isolation:
%TEMP% (or $TMPDIR on Linux)
├── csscript.core\ # CLI execution (cscs.exe, csws.exe)
│ ├── cache\ # Compiled script cache
│ ├── snippets\ # `-code` execution cache
│ └── DbgAttach\ # Debug metadata
└── csscript.lib\ # Library/hosted evaluation (CSScriptLib)
├── cache\ # Compiled script cache
└── tmp files # Temporary compilation artifacts