Thursday, 20 November 2025

The Concept of C# Scripting (.csx files)

The concept of C# scripting bears semblance to Jython in Java (more so than JavaScript to Java).

Scripting commands will not be allowed in regular programs.

Here's an example:

#r "nuget: Microsoft.SuperAdvancedKernel, 1.23.0"

It can be used in environments like .NET Interactive and Jupyter Notebooks with .NET. It came into being in Visual Studio 2015.

The file needs to be .csx file.

#r is the reference directive, to reference an assembly or package.

No comments: