Friday, August 17, 2018

cs-script or compile


today I evaluated how easy it is to compile code in the command line and wanted to compare it to C# interactive window.

This is my generic script to compile

@echo off
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe /t:exe /out:output.exe *.cs >nul 2>nul
del output.exe

Consider, I need a fully blows c# file to write hello world to the console:

Something like
// A Hello World! program in C#. using System; namespace HelloWorld { class Hello { static void Main() { Console.WriteLine("Hello World!"); // Keep the console window open in debug mode. Console.WriteLine("Press any key to exit."); Console.ReadKey(); } } }

(see: )

This is a bit much in comparison to (started in developer command prompt):

command: csi csitest.csx
content:     Console.WriteLine("Hello World!");

We definitely have a winner here... 


No comments: