CS-Script Branches

CS-Script Engine

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.

CS-Script supports both hosted and standalone execution model. This makes it possible to use the script engine as a pure C# alternative for PowerShell or Bash. As well as extending .NET applications with C# scripts executed at runtime by the hosted script engine.

It can be run on Win, Linux and Mac. And it is compatible with .NET and Mono.

CS-Script.Core Engine

CS-Script.Core is a port of CS-Script on .NET Core. While it is a natural answer to the raise of the .NET Core adoption it is also a refinement of the CS-Script as a solution.

The objective CS-Script.Core is to bring the most used and valuable CS-Script features to a new platform and streamline the utilisation access to the most exciting new features of C# and .NET Core.

While currently both streams (CS-Script and CS-Script.Core) are supported equally. The development emphasis will steadily be shifted towards CS-Script.Core.

Development Tools Integration

CS-Script also offers comprehensive integration with most common development tools and utilities:

  • Visual Studio
  • VSCode
  • Sublime Text 3
  • Notepad++
  • Command Prompt
  • Bash shell
  • Chocolaty
  • Windows Explorer


CS-Script is a CLR (Common Language Runtime) based scripting system which uses ECMA-compliant C# as a programming language. CS-Script today is one of the most mature C# scripting solutions.

CS-Script supports both hosted and standalone execution model. It allows seamlessly switching underlying compiling technology without affecting the code base. Currently supported compilers are Mono, Roslyn and CodeDOM. It offers comprehensive integration with most common development tools.

For all CS-Script details visit project Documentation Wiki.


The following is a simple code sample just to give you the idea about the platform:

Executing scripts from a .NET host application: Hosting script engine

dynamic script = CSScript.LoadCode(@"using System.Windows.Forms;

                                     public class Script
                                     {
                                         public void SayHello(string greeting)
                                         {
                                             MessageBox.Show($""Greeting: {greeting}"");
                                         }
                                     }")
                          .CreateObject("*");

script.SayHello("Hello World!");
//-----------------
var product = CSScript.CreateFunc<int>(@"int Product(int a, int b)
                                         {
                                             return a * b;
                                         }");
int result = product(3, 4);
//-----------------
var SayHello = CSScript.LoadMethod(@"using System.Windows.Forms;

                                     public static void SayHello(string greeting)
                                     {
                                         MessageBoxSayHello(greeting);
                                         ConsoleSayHello(greeting);
                                     }

                                     static void MessageBoxSayHello(string greeting)
                                     {
                                         MessageBox.Show(greeting);
                                     }

                                     static void ConsoleSayHello(string greeting)
                                     {
                                         Console.WriteLine(greeting);
                                     }")
                       .GetStaticMethod("SayHello" , typeof(string));

SayHello("Hello again!");

Executing script from shell

Updating media file tags. Note, the script is using optional classless layout.

Script file: mp4_retag.cs

//css_nuget taglib
using System;
using System.IO;

string source = @"\\media-server\tv_shows\Get Smart\Season1";

void main()
{
    foreach (string file in Directory.GetFiles(source, "*.mp4"))
    {
        string episode_name = Path.GetFileNameWithoutExtension(file);

        var mp4 = TagLib.File.Create(file);
        mp4.Tag.Title = episode_name;
        mp4.Save();

        Console.WriteLine(episode_name);
    }
}

Execute script file directly in cmd-prompt without building an executable assembly:

C:\Temp>cscs mp4_retag.cs