Executing the C# script on a Visual Studio developer command prompt using csi.exe
In this section, we will show you how to use the command-line interface for executing C# scripts and their interactive mode. csi.exe
(CSharp Interactive) is the CLI executable for C# interactive that ships with the C# compiler toolset, along with Visual Studio.
Getting started
You will need to have the Visual Studio 2017 Community edition installed on your machine to execute this recipe. You can install a free community edition from https://www.visualstudio.com/thank-you-downloading-visual-studio/?sku=Community&rel=15.
How to do it...
- Start the Visual Studio 2017 develop command prompt and execute the command
csi.exe
to start the C# interactive session. - Type
Console.WriteLine("Hello, World!")
on the console and click on the Enter key to execute the command in interactive mode:
- Press Ctrl + C to exit the interactive mode.
- Create a script file
MyScript.csx
with the following code to output the arguments to the script...