dotnet-cs 0.0.14

dotnet tool install --global dotnet-cs --version 0.0.14
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local dotnet-cs --version 0.0.14
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=dotnet-cs&version=0.0.14
                    
nuke :add-package dotnet-cs --version 0.0.14
                    

dotnet-cs

A tool that makes it easy to run C# from a file, URI, or stdin.

Currently requires .NET 10 SDK daily build, version 10.0.100-preview.4.25179.3 or later

Installation

dotnet tool install -g dotnet-cs

Usage

cs <TARGETAPPFILE> [<APPARGS>...] [options]
<COMMAND> | cs [<APPARGS>...] [options]
cs -
cs [<APPARGS>...] < <CSFILE> [options]

Arguments

Name Description
<TARGETAPPFILE> The file path or URI for the C# file to run. Pass '-' to enter interactive terminal mode.
<APPARGS> Any arguments that should be passed to the C# app

Options

Name Description
-?, -h, --help Show help information
--version Show version information
--edit Edit content in an interactive terminal C# editor

Examples

Run a C# file named hello.cs in the current directory:

~/apps
$ cs hello.cs
Hello, world!

Run a C# file named hello.cs in a sub-directory and pass an argument to it:

~/apps
$ cs ./utils/hello.cs David
Hello, David!

Run a C# file from https://github.com/DamianEdwards/csrun/tree/main/samples/hello.cs and pass an argument to it:

~/apps
$ cs https://raw.githubusercontent.com/DamianEdwards/csrun/refs/heads/stdin/samples/hello.cs Stephen
Hello, Stephen!

Pipe C# code from a shell string literal to cs:

$ 'Console.WriteLine("Hello, world!");' | cs
Hello, world!

Pipe C# code from shell command output to cs via stdin:

$ cat hello.cs | cs
Hello, world!

Enter interactive stdin mode to just type C# straight into the terminal:

$ cs -
Reading from standard input. Press Ctrl+R to execute..
Console.WriteLine("Hello, world!");
Running...
Hello, world!

Edit a C# file named hello.cs in the current directory:

~/apps
$ cs hello.cs --edit
Interactive C# editor! Press CTRL+R to run, CTRL+ALT+S to save, CTRL+Q to quit.
01 var name = args.Length > 0 ? args[0] : "World";
02 Console.WriteLine($"Hello, {name}!");
Hello, world!
Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
0.0.14 206 4/22/2025
0.0.13 167 4/7/2025
0.0.12 120 4/5/2025
0.0.11 185 4/3/2025
0.0.10 169 4/3/2025
0.0.9 106 3/29/2025
0.0.8 117 3/29/2025
0.0.7 168 3/19/2025
0.0.6 150 3/17/2025
0.0.5 82 3/14/2025
0.0.4 85 3/14/2025
0.0.3 158 3/13/2025
0.0.2 152 3/13/2025
0.0.1 149 3/13/2025